Data

# A Template for Date Calculations in Tableau

The most common calculations I make in Tableau are date-related. I’ve made hundreds of them with variations for year-over-year, month-over-month, rolling date ranges and a long list of customizations. Some of our most popular blog posts at InterWorks are those teaching people how to handle this kind of date math. Frankly, a need this common should be easier. Well, now it is!

The template described below contains common date-based options and calculations. It simplifies your workflow, letting you cut and paste all the logic you need. Customizing those options takes a few simple steps.

## Using the Template

1. Download it from Tableau Public (which may be updated periodically), or click on the file at the bottom of this post.
2. Open the workbook in Tableau Desktop, and start on the tab named Date Logic Template.
3. Read the procedures there, then click Go to Worksheet to access the data source with the calculations you need. This worksheet also lets you inspect the result of each calculation and parameter option day by day.
4. To further understand the options and how to use them, click through the tabs for detailed logic explanations and instructions on building the example visualizations.

## Performance Considerations

Astute observers will see that this template uses a lot of parameter-based row-level calculations. These can negatively affect performance, especially on larger datasets. If you experience poor response times with your data, you can remove the parameter references and create separate calculations specific to each time range. That approach lets you materialize the calculation result in a Tableau extract.

## Further Reference

For more in-depth explanation and variations on date calculations, see these posts:

If none of these resources speak to your specific need, we’re here to help! Contact our experts for customized support.

## Robert Rouse

Analytics Consultant
Disney Data & Analytics Conference 2019 in Review At Disney World, every park has a theme. What you may not know is that their annual data and analytics conference has a theme, too. In ...
A Template for Date Calculations in Tableau The most common calculations I make in Tableau are date-related. I’ve made hundreds of them with variations for year-over-year, ...

See more from this author →

• I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
• This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072