A common use case is to determine when a new event occurs, such as when a new maximum profit is achieved.
1. Create a new worksheet titled Maximum Profit
2. Drag Order Date onto the Columns Shelf and aggregate as month as a date value
3. Drag SUM (Profit) onto the Rows Shelf
4. Change the Mark Type to Bar
Each bar visualizes monthly total profit. The goal is to use color to highlight when a new maximum profit has been achieved; this requires that the current mark be compared the remaining marks.
5. Create a new calculated field titled New Max Profit; edit the calculation as shown below:
The logic instructs Tableau to compare the each month’s sum profit against the running maximum of sum profit up to and including the current month, which results in a true/false outcome.
6. Drag New Maximum Profit onto the Color Shelf
The running maximum is a table calculation being computed table across (the default method). Consider the first month, January 2013. January 2013’s total profit was $2,450. Since the running maximum is being computed table across, the running maximum for January 2013 only includes one value, which also equals $2,450. Since these values are equal to each other, it’s a new maximum value.
Let’s look at February 2013 next. February 2013’s total profit was $862; the running maximum now includes January 2013 and February 2013. The maximum value from these two months is still the $2,450 from January. This means that the current month’s profit does not equal the running maximum, meaning a new maximum value has not been achieved.