Year To Date Total

Year To Date Total (YTD) calculation helps compute how a value increases year to date. For example, it helps compute increases in sales over time (quarter by quarter within a year). It is similar to the running-total calculation but requires two date elements and a measure.

Using Tableau’s Global Superstore Orders table:

  1. Drag an Order Date field from the Data pane to the Columns shelf. Default is Years.
  2. Drag an Order Date field from the Data pane to the Columns shelf. Change it to Quarters.
  3. Drag a Sales field from the Data pane to the Rows shelf.
  4. Drag another Sales field from the Data pane to the Rows shelf.
    • Right-click this Sales field (second one), Quick Table Calculation, and select YTD Total. This second field will have a delta symbol.
  5. Drag a Sales field from the Data pane to Label on the Marks card.

Format: You could format the two Sales fields with corresponding currencies.

Relative to Order Date: The default here is to compute using the Order Date field.

Final Result: I have created two graphics (top and bottom) to show the difference between regular sales over time and year to date sales. For example, in Year 2012, Sales increased ($336K + $479K) = $814.65K or $815K between Quarter 1 and Quarter 2. Then from Q2 to Q3 adding $814.65K + $613K = $1,427.96K. Lastly, from Q3 to Q4, adding $1,427.96K + $831K = $2,259.45K or $2,258.96K. Next year, the quarters are added again.

Leave a Comment

Your email address will not be published. Required fields are marked *