Tableau Tips : Comparing Sales For Current Date, Month Before And Year Before




Many times we come across situations when we have to compare values for different time period. With reference to our Sample Superstore data lets say we would like to see the sales of a Category for a specific date and then compare its sales a month back and a year back.
For example lets say we are interested in knowing the Sales of furniture on 5 Nov 2016, 5 Oct 2016 and 5 Nov 2015 and want to compare these sales.
Lets see how to achieve this in tableau.

Step 1: Create a Date parameter that gives a date value for which we can compare the sales.

Step 2:  Create a calculated field to compute the sales for the date to be chosen by the date parameter.

Step 3: Create a calculated field to compute date one month back

dmb.PNG

Step 4: Create a calculated field to compute the sales for one month before the date chosen by the date parameter.

Step 5: Create a filed to compute the date one year back:

dyb.PNG

Step 6: Create a calculated field to compute the sales for one year before the date chosen by the date parameter.

Once created Bring the Measure Names to filter and select the three created filed , Sales Today, Sales Last month and Sales Last Year.
Bring Measure names to rows and Measure values to columns. Select bar Charts and place measure values into the colour shelf. Drag category to the filters .

 

Choose the date using the parameter and the values will update accordingly.
The following workbook demonstrates the same :