Conditional Formatting feature is important to gather quick insights on the displayed KPI.

In this blog, we are going to see how to set Conditional Formatting on a KPI number based on a dynamic threshold (comparing against another KPI) in Tableau.

Steps

1. As you can see, we have an empty canvas and are going to add Conditional Formatting on “Sales” KPI comparing against last year sales: “Sales LY”.

Tableau – Conditional Formatting on a KPI

2. Drag Sales and Sales LY KPIs to Text Mark card.

Tableau – Conditional Formatting on a KPI

3. Now, click on Text Mark card and edit the content to get the output as shown below:

Tableau – Conditional Formatting on a KPI
Tableau – Conditional Formatting on a KPI

4. Let us format the scaling of the numbers for both KPIs by right-clicking on KPIs available in green colour in Marks card and format.

Tableau – Conditional Formatting on a KPI

5. In this case, we are going to set the green color for total sales KPI if it is greater than last year otherwise red.

6. We will create 2 calculated fields: ‘sales positive’ and ‘sales negative’.

(Please note, in our example, Sales LY is a calculated field and aggregated already)

Tableau – Conditional Formatting on a KPI
Tableau – Conditional Formatting on a KPI
Tableau – Conditional Formatting on a KPI

7. Please note that only one of them will hold sales value at any given point of time. Drag both fields and place it in ‘Text Mark card.

8. As soon as we dragged both the fields, only one of them populated in canvas.

Tableau – Conditional Formatting on a KPI

9. Now click on the Text Mark card and change the KPI for sales as shown below:

Tableau – Conditional Formatting on a KPI

10.Also, change the color of each KPI according to condition. So, ‘sales negative’ KPI should be in red and ‘sales positive’ in green. I have just increased the font size of both KPIs.

Tableau – Conditional Formatting on a KPI

11.Click ok and you should see your ‘Sales’ value in green color.

Tableau – Conditional Formatting on a KPI

12. I have formatted the scaling and decimals for both sales negative and sales positive KPI.

Now based on the data updates and value, Conditional Formatting will be taken care and respective colors will be assigned to the KPI accordingly.

To learn more about Visual BI’s Tableau Consulting & End User Training Programs, contact us here.


Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com


Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!