Tableau: Show multiple time periods, MTD, QTD, YTD on same column?

Category:
Question ID: 109800
0
0

How can I show multiple periods (WTD, MTD, QTD, YTD, and LYTD) across my columns in one row like Microsoft excel?

Marked as spam
Posted by (Questions: 10, Answers: 3)
Asked on August 19, 2020 8:56 pm
32 views
Answers (1)
0
Private answer

You can create WTD, MTD, QTD, YTD, and LYTD columns for your sales values and place them on Text/Label shelf (see below formulas).  Drag the first field to TEXT and double-click on the remaining fields/columns.  Tableau will automatically add the measure name to the Column shelf and Measure values to Text/Label shelf.

 

Create the following calculations for WTD, MTD, QTD, YTD, and LYTD:

WTD:

IF DATEDIFF('week', [date].(TODAY()-1))=0 THEN [Sales] END

 

MTD

IF DATEDIFF('month', [date].(TODAY()-1))=0 THEN [Sales] END

 

QTD:

IF DATEDIFF('quarter', [date].(TODAY()-1))=0 THEN [Sales)] END

 

YTD:

IF DATEDIFF('year', [date].(TODAY()-1))=0 THEN [Sales)] END

 

LYTD:

IF DATEDIFF ('year', [date], TODAY()) = 1   AND [date] < DATEADD ('year',-1, (TODAY()-1)  THEN [Sales] END)

Marked as spam
Posted by (Questions: 3, Answers: 10)
Answered on August 19, 2020 9:04 pm