Dates in Tableau Calculations

ate formatting is a crucial aspect of many reports. Recently I found a useful trick in Tableau for formatting dates when using calculated fields. Using the DateTrunc formula, it is possible to aggregate the raw values up to a particular date in a time period. The DateTrunc calculation will take the values in the specified data, and aggregate them to a specified time period.
For example, take the case where it is necessary to sum the sales value for a month. The DateTrunc could be used to sum the sales values for a month, and then it is possible to select from a wide range of date formats to display the date information.
In order to show the use of this particular calculation, and the range of date formats, I’ve produced a 2-minute video below.
This also shows some of the problems that you might run into when you are creating a calculated field. For example, the calculated field editor is Case Sensitive.
  • datetrunc(‘Month’,[Order Date]) will not work
  • datetrunc(‘month’,[Order Date]) will work!


Leave a Reply