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.
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
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 :
This will give you the correct results.
Further learning:
https://www.learntableaupublic.com/
About the Author
Chandraish Sinha has 20+ years of experience in Information Technology. He is an accomplished author and has published 11 books covering Business Intelligence related topics such as, Tableau,Power BI, and Qlik. Checkout his Amazon Author profile.
His latest book Excel Basics to Advanced covers all the aspects of MS Excel and provides exercises for self-learning.
Similarly, his recent book, Dashboarding with Tableau, covers all the features in Tableau and includes exercises for self-learning.
He has implemented IT solutions in different domains viz. Pharmaceutical, Healthcare, Telecom, Financial and Retail.
He blogs regularly on various IT topics. Check them out in the links given below: