Example - Spotlighting Using Calculations

Spotlighting is a technique for showing discrete thresholds based on the values of a measure. For instance, you might want to color-code sales so that those over 10,000 appear green and those below 10,000 appear red. A spotlighting calculation is just a special case of a calculation that results in a discrete measure. A discrete measure is a calculation that is a dependent variable (and therefore a measure), but which results in a discrete result (as opposed to a continuous result). Thus the name discrete measure. Here is an example:

Calculation dialog showing a formula that uses the IIF function to check whether a condition is met, and returns one value if true, another value if false, and an optional third value or NULL if unknown.

The formula in this example defines a discrete measure named Sales Spotlight. Discrete measures always appear with a blue abc icon in the Data pane. Sales Spotlight is classified as a measure in Tableau because it is a function of another measure; it is discrete because it produces discrete values (“Good” and “Bad”). Here is an example of this categorical measure in use:

A table in a viz showing sales for various categories and sub-categories across three segments: consumer, corporate, and home office.

Here, Sales Spotlight is on Color in the Marks card. It appears with the AGG prefix because it is an aggregate calculation. Values above 10,000 and below 10,000 are assigned different colors.