Select Page

Quite often, we need a concise way to show the most important numbers of the organization’s performance. Presenting these Key Performance Indicators (KPIs) in captivating cards is thus, an essential strategy. In this post, we will explore the step-by-step process of creating KPI cards in Tableau, enabling you to present the key metrics with impact and clarity. The inbuilt sample superstore dataset will be used for the demonstration in this blog.

Step 1: Determine your KPIs.

First and foremost, think about the clients’ needs, and which metrics are the most impactful for them. In this example, the average yearly profit ratio will be used as the main metric, and the grand average of this ratio (averaging all the average yearly profit ratio) will be added as a baseline comparison.

Step 2: Create a table to calculate these numbers.

First let’s generate the rows with our years. Drag the “Order date” into the “rows shelf”. Then to populate the rows with the measure of interest (in this case average profit ratio), drag the profit ratio into “Text” icon in the “Marks” card. Next, we will need to add a column containing the “grand average of the yearly profit ratio”. To do so, create a calculated field with this formula;

The formula simply returns the average of all four yearly profit ratios that appear in this table. Drag the newly created “Grand Average” field into the “Text” icon in the “Marks” card. Format them by clicking on the “Text” icon, then select the “…” option. Here, you can add text and select the font, size and colour of the text. My current table now looks like this:

Step 3: Showing only the values of the selected period.

To add more interactivity, based on end-user input, we can show only the year of interest ratio and grand average value instead of showing all years’ values. For instance, in this example, let us show only the latest year profit ratio (based on the selected range of years) and the grand average value.

To do so, first, we need to create a filter based on the years of interest. First, hold CTRL key and drag the “YEAR(Order date)” from the “Rows shelf” into the filter shelf, and select “Range of Dates”. Show the filter by right clicking on it and select “show filter”. The filter now appears on the right hand side of the tableau window under “Show Me.

Secondly, to show only the latest value of the selected period, create a calculated field with this formula:

The logic reads as follows; If the row’s year is equal to the max year of this data then return “True”. Now drag this newly created field to the right of “YEAR(Order Date)” in the “Rows Shelf”. This will create a new column with “False” and “True” values. Right click on the “False” data and select “Hide”. Now, only the latest year’s value and the “grand average” are shown.

Note that when we select a range of dates with the maximum period less than the maximum value of the filter (e.g., from 3/01/2020 to the end point of 3/01/2021 instead of the maximum filter value of 30/12/2023), then the value will disappear from the table.

This is because the table is now fixed to show only the latest 4 years value due to the “FIXED Level of Details” expression above. To overcome this, and show the max value of the selected period, right click on the “Order date” pill in the “Filters” card, and select “Add to context”. Now the value will appear again!

Step 4: Format the KPI card.

In the KPI card, we typically only want to show the numbers, so we can hide all the headers and format the lines out of the view (right click on the undesirable text in the table and tick “Show header” off, and format the column divider to show none). And this is the final product!

KPI card is a very efficient tool to show the key metrics of the organization’s performance. Although it only shows a few numbers, the process of ensuring that the numbers are correct can be complicated with Tableau’s level of details expressions and table calculations. Hopefully, the guide provided in this blog is helpful in explaining the process of KPI card creation. Happy vizzing!