In my previous tutorial :¬†Uncovering Trends: Comparing Sales from This Year to Previous Years in Tableau , I demonstrated how to create a line chart for comparing current sales to the previous year’s sales. In this tutorial, I will be showing how to generate KPIs for this line chart.

My KPI design is straightforward. I plan to incorporate this year’s sales, prior N year sales, and the percentage change between them. To indicate an increase in percentage, I will use a green upward arrow, and for a decrease in percentage, a red downward arrow.

Step1: Create a Calculated Field: % Difference

(SUM([Current Year Sales])-SUM([Prior Year Sales]))/SUM([Prior Year Sales])

Step 2: Create the “Positive % Change” and “Negative % Change”

Here’s the CF for the Positive % Difference. Likewise, we create one for the Negative % Difference.

I used this website to find the Black Up-Pointing Triangle.

step3: Drag the “Positive % Change” and “Negative % Change” to the Text and change the color

Step 4: Create a Dummy and highlight the Dummy

Using the line graph as a filter has the trouble of greying out other areas whenever it is clicked on. To achieve this, a Dummy variable will be utilized to highlight the charts. To implement this technique, begin by creating a Dummy Calculated Field and assigning a value of “1” to it. Next, add the Dummy to Detail and highlight it for both the line chart and the KPIs.

This technique was imparted to me by our Assistant Coach Ross during a recent project, and I hope it will be useful for those who find this bothersome. You can also check Andy Kriebel’s Youtube Tutorial about this trick¬†link

 

 

We now have a simple dashboard that compares this year’s sales with those of the previous year. By clicking on different months, the KPIs and arrow colors will change to reflect the sales changes.

Hope you enjoy this tutorial!

 

The Data School
Author: The Data School