How can I show multiple periods (WTD, MTD, QTD, YTD, and LYTD) across my columns in one row like Microsoft excel?
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)