Hello everyone,
I'm trying to build a highlighting logic in Tableau and would appreciate any suggestions.
I have an employee score, and I want to highlight the row corresponding to the decile in which that score falls.
For example:
- Employee Score (V2A) = 100.399
- Month = June
- This score falls between:
- ----INCENT_V2A_DECILE_5_MIN
- ---INCENT_V2A_DECILE_5_MAX
- Refer to column D i.e METRIC=MTD and for decile column f Decile
- Therefore, I want to highlight the this columns row.
In my data:
- Column E (V2A) contains the employee's score.
- Columns G–Z contain the Min and Max values for each decile.
For example:
Original Column Display
INCENT_V2A_DECILE_1_MIN 1
INCENT_V2A_DECILE_2_MIN 2
... | ...
INCENT_V2A_DECILE_10_MIN 10
I want Tableau to compare the employee's V2A score against each Min/Max range and highlight the row where the score falls.
For example:
IF [V2A] >= [incent_v2a_decile_5_min]
AND [V2A] <= [incent_v2a_decile_5_max]
THEN Highlight Decile 5
However, I have 10 deciles (20 Min/Max columns), and I'm looking for a scalable or elegant way to implement this in Tableau rather than writing a long IF statement.
Has anyone implemented something similar? Would you recommend pivoting the decile columns first, or is there a better Tableau approach?
I've attached a sample of my data for reference.
Thanks in advance!
Sample output
#Tableau Public
I would pivot the decile columns first. Your data is currently too wide for Tableau.
After pivoting, create:
IF [V2A] >= [Min]
AND [V2A] <= [Max]
THEN [Decile]
END
Put this field on Color to highlight the matching decile row.
This avoids writing 10 separate IF statements and will still work if you add more deciles later.