Custom Attribute (Decision Table)

Turn numbers into labels or colours with a table of rules instead of a formula: "when hours are under 6, Morning; otherwise Evening". Defined once, reused in every tile and report.

⚠️ Prerequisite Custom Attribute (Select) explains where custom attributes live and how to add one.

A decision table is a custom attribute whose value comes from rules you fill in, not from SQL you write. Each row says when these conditions hold, then the value is this. It works like any other custom attribute: it appears in blue in the attributes list, is computed when the query runs, and nothing is written to your database.

When to Use One

  • Banding values into labels: hours under 6 are Morning, 6 and over are Evening; order totals into Small, Medium, Large.
  • Choosing colours: more than 6 customers is green, 6 or fewer is blue, then colour a chart or table from it (see Colouring a Visual).

Creating a Decision Table

  1. Click + New Attribute under the table it belongs to, as for any custom attribute.
  2. Give it a name (no spaces) and, optionally, a description.
  3. Set Attribute Type to Decision Table (the default).
  4. Drag the attributes the rules depend on into the When header. Each becomes a column of conditions.
  5. Fill in each row: for every column pick an operator (=, >, >=, <, <=) and a value, then type the result in Then. Use Add new row for more rules.
  6. Optionally set a Default Value: what the attribute is when no row matches.
  7. Save. The attribute is ready to drag into any visual.

How the Rules Are Applied

  • Rows are checked from top to bottom, and the first row that matches wins. Put the most specific rules first.
  • All conditions in a row must hold for that row to match.
  • No match gives the Default Value, or an empty value if you didn't set one. So leave no gaps: in the hours example, < 6 and >= 6 together cover every value.
  • Conditions compare numbers. Use them on numeric attributes, such as counts, totals, hours or scores.
  • Because the rules run as part of the query, the attribute is computed for every row the visual fetches, and changing a rule updates every visual that uses it.

Colouring a Visual From a Decision Table

Make the Then values colour names or codes (green, #c62828). Then:

  1. Add the decision-table attribute to Show me, and hide it from the visual with its eye icon if you don't want it shown.
  2. Open the settings of the measure you want to colour and open its colour picker.
  3. Choose the Series tab and pick the decision-table attribute.

Each bar, slice or cell now takes its colour from the rule that matched its row. Edit the rules later and every visual using the attribute follows.

💡 Decision table or Select Query? Use a decision table when the logic is a list of thresholds anyone should be able to read and change. Use Select Query when you need a full SQL expression.