Courses
Courses

Perform calculations based on a specific date in Tableau

October 7, 2022

Perform calculations based on a specific date in Tableau

In this blog, we will learn how to perform calculations based on a specific date in Tableau.

Business requirement: Find the Sales that occurred on 1/3/2019.

To explain this concept, we will be using Sample-superstore.xls. This data source comes with the installation of Tableau desktop.

If you are new to Tableau, learn how to connect to Sample-superstore.xls in Tableau.

Dates in Tableau

When we connect to a data source, and the date is extracted in the correct format in Tableau, it is displayed with a calendar icon next to the Date.

Date displayed with a calendar icon

This date format is fine for any date operations unless you have to use a specific date in a calculation.

We have to calculate Sales that occured on Order Date = ‘1//3/2019’

If we use a calculation such as

Error in Date calculation

Even if we use the above calculation by removing the quotes around the date, it will still give an error.

To perform a calculation based on a specific date, always enclose the date within # #.

The correct calcuation will be :

Date calculation with # symbol

This will give you the correct results.

Further learning:

https://www.learntableaupublic.com/

Leave a Comment