Formatting KPIs in Tableau

Alisha Dhillon
7 min readFeb 1, 2023

--

In this post, we will look at how to elevate the ordinary KPI.

This blog follows my previous one in which I looked at creating KPIs within a single sheet.

We will look at:

  1. Adding Indicators to your KPI
  2. Adding conditional colours to your indicators within your KPI
  3. Formatting the line of your line chart
  4. Condensing your KPI to the relevant span of months
  5. Using labels and removing the tooltip to enhance your KPI

Adding Indicators to your KPI

  1. Go to your Percentage Difference Calculation > Default Properties > Number Format.

2. Select custom.

3. Search for character map on your computer so you can copy and paste the shapes that you prefer. In this example, we will be using triangles as up and down indicators.

4. Copy the black up-pointing triangle to the first part of the custom number format. This will represent your positive values.

▲0.0%

5. Add a semi-colon to separate your negative values and following the same format, add a black down-pointing triangle followed by 0.0%.

;▼0.0%

6. Hit OK. You will notice that the indicators will have replaced the +/- that existed before.

Adding Conditional Colours to your Indicators within your KPI

  1. Edit your % difference sales calculation if there is a custom number format applied. Ensure that it is set to 0.0%.

2. Create a new calculation and call it ‘▲ % Difference Sales’. Add the following calculation within it. Hit ok.

IF [% Difference Sales] >=0 THEN ‘▲’ ELSE ‘’ END

3. Create another new calculation and call it ‘▼ % Difference Sales’. Add the following calculation within it. Hit ok.

IF [% Difference Sales] <=0 THEN ‘▼’ ELSE ‘’ END

4. Add the two new calculations to detail within your marks card. If you are using a table calculation, they should be calculated by specific dimensions.

5. Now you can edit your title and insert both side by side, before your percentage difference sales as such.

SALES

<AGG(Current Month Sales)>

<AGG(▼ % Difference Sales)><AGG(▲ % Difference Sales )><AGG(% Difference Sales)> vs PM <AGG(Previous Month Sales)>

6. Edit the colours of the up and down arrow calculations as such.

You can do this by highlighting the particular calculation and selecting the preferred colour.

7. You will notice that your KPI should update to look like this:

When I filter to a year with a positive trend, the icon changes.

Formatting the Line of your Line Chart

The default line applied in a line chart looks like this:

This is a quick build of sales by month of order date. The line is blue by default and of medium thickness.

One of my quick hacks for elevating your KPI is to reduce the thickness of the line and of course change the colour.

  1. Reduce the thickness by selecting size on the marks card and dragging the grabber down.

You may like the original size but personally, I find that reducing the thickness gives it a cleaner look. I usually opt for in between the first and second mark.

2. Change the colour! Designing KPIs should not be boring. Tailor it to the organisation that you are working for, use themed colours or if practicing, pick what you like.

You should be checking if anybody in your team has any vision difficulties such as being colour-blind. I love using coolors.co for inspiration.

Here is a randomly generated palette:

This is what it looks like for someone with one of the types of colour blindness. You can change this within the generator.

Condensing your KPI to the relevant span of months

This can be useful if you do not need all of your time series data plotted. You can decide to include the last 12 months, 6 months or anything you wish. Ideally, this should be dynamic and therefore, this is the approach that I like to take.

  1. Create a latest date calculation. Identify the maximum date to count back from.

{max([Order Date])}

2. Create a calculation to get the number of months from your latest date. I called mine ‘12 months from Max’.

datetrunc(‘month’,[Order Date])>= datetrunc(‘month’,dateadd(‘month’,-11,[Latest Date]))

The key in this calculation is the -11. You could change this to -5 to take the latest month and then count back 5 months and therefore, giving you a total of 6 months from the latest date.

3. Add the second calculation, 12 months from Max, to your filters shelf and select ‘True’.

There you go! You should have condensed your line chart to start from the number of months specified.

Before the calculation:

After the calculation:

It is a lot easier to see the trend and focus on a particular period, in this case, the last year (12 months), which has quite an upward trend.

Using Labels and Removing/ Keeping the Tooltip to Enhance your KPI

There are various ways in which you can use labels.

  1. You will need to select show mark labels within Label in your marks card to get them to appear.

2. Select the option relevant to you. A KPI with ‘All’ selected would look very busy. You can decide to highlight something important or even min and max.

I went for selected in this example so that the label value appears when you select the mark. If I was presenting this in a meeting and somebody wanted to dig deeper, they could. You will notice that the tooltip appears and makes it difficult to read therefore, you could remove the tooltip but instead include the month into your label so people can select the month AND value.

3. Remove the tooltip by selecting Tooltip in your marks card and unchecking the first selection ‘Show tooltips’. Alternatively, don’t! You can format it to show the month and the value.

The purpose of a tooltip is to provide extra context. When you have a KPI dashboard with a high-level overview, you may want to turn off the tooltip feature as it becomes very busy. If you do this, you may still want to keep the axis to show the month that you are hovering over. Alternatively, why not keep some basic information which will allow the user to hover and dig deeper?

-

Hopefully, these tips are useful in elevating the ordinary Tableau KPI. I should add that these are just some ways that I like to approach my KPIs and therefore, you may want to tailor some of these tips for your own use case.

Do you have a favourite formatting tip? Do feel free to comment and share!

--

--

Alisha Dhillon

Business Intelligence Analyst | Ex DS21 | Tableau Public Featured Author 21 | 2x VOTD | @infolabuk @dataschooluk Alumni