KPI's & a Chart in one sheet

by Zdravka Bratuhtcheva

How to build a single worksheep KPI with a chart. The main benefit of this is that it allows us to use less sheets on out dashboards, it saves time formating and the sheets look uniform.

First we need to create 4 calculated fields.

Calculation 1: Sales for the Current Year - Sales CY

Here is the calculation:

{FIXED : SUM(IF YEAR([Order Date])={MAX(YEAR([Order Date]))} then [Sales] END )}

It says that if the year in the table equals the maximum year in the table, i.e. the current year, then return the sum of sales for the maximum year in the table.

Calculation 2: Sales for the Current Year - Sales CY

{FIXED : SUM(IF YEAR([Order Date])={MAX(YEAR([Order Date]))} -1 then [Sales] END )}

It says that if the year in the table equals the maximum year in the table MINUS 1, i.e. the previous year, then return the sum of sales for the previous year in the table.

Calculation 3: The change of value in comparison to the previous year

(SUM([Sales CY])- SUM([Sales PY]))/SUM([Sales PY])

Then I will change the formatting to include a symbol in front of the number and a % sign at the end. There is a great video how to do that form Valerija Kirjackaja here: https://www.youtube.com/watch?v=FmdgfFvSb_g&t=89s.

Calculation 4: Selecting the last year in view

DATETRUNC('year', [Order Date]) >= {MAX(DATETRUNC('year',[Order Date]))}

Now all we need to do is create out Profit and Sales cards. I have followed Andy’s advice in his Tableau Tip Tuesday video (link below). I smply created a chart of choice and added the calculated fields in the title of the sheet. I have used calculation in the filter pane to view only the current year. Here is the result!

Voila!

Resources:

Unicode characters table: https://unicode-table.com/en/

How to in Tableau in 5 mins: Format Performance Indicators by Valerija Kirjackaja: https://www.youtube.com/watch?v=FmdgfFvSb_g&t=89s.

How to Create KPI and Sparklines in a Single Sheet by Andy Kriebel: https://www.youtube.com/watch?v=ZQi1Uh8bNVQ

Avatar

Zdravka Bratuhtcheva

Mon 04 Jul 2022

Thu 30 Jun 2022

Wed 29 Jun 2022