KPI Date Parameters

In this blog, you'll learn how to create a dynamic KPI in Tableau that displays the percentage change in Sales from the previous month. Using the Superstore sample data, we'll incorporate a month-based parameter so users can easily select and compare sales in different months.

End Product
  1. Format your Dates Accordingly:
    1. Right click Order Date -> create -> custom date
    2. Detail -> months
    3. Name this 'Order Date (Months)'

Create Order Date Months Parameter:

  • Right click on order date months -> create parameter
  • Display format will be in mmm yy format for this example

Create Calculated Fields for the parameter selected month and the prior month

Parameter Selected Month

    1. IF [Parameter] = [Order Date Months] THEN [Sales]
      1. This will show the sales of the month selected by the parameter

Prior Month to Parameter Selected Month

For the prior chosen dates sales, in this case the previous month:

      1. IF DATEADD(‘month’,-1, [Parameter] = [Order Date Months] THEN [Sales] END

The DATEADD function is used to add or subtract days, weeks, months, years etc from the selected date and will be used to analyse the difference in sales 

  • Now that we have the parameter selected month and the month prior, we can find the percentage difference between them:
  • Create the calculated field:

CREATING THE BAR CHART

  1. To create a bar chart that shows the current year’s sales, create a dual axis by putting both the selected month and prior month (or whichever date measure you end up using) in Columns, right clicking either green pill and selecting 'Dual Axis'
    1. Synchronise the axis
    2. Change the Prior Date to a Gantt chart in the marks card, this will create the blue bar along the graph that sets the point of sales of the previous month
    3. Change the Selected Date to a Bar chart in the marks card
    4. Add 'Measure Names' to Colour, Prior month to blue and selected month
    5. Right click % difference pill -> default properties -> number format -> custom (turn to percentage format and add arrows using Windows and . key, (geometric symbols) ) ↑0.00%;↓0.00%;0.00%
Author:
Andrew Buchanan
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab