Last Modified Date: 08 Dec 2022
Environment
- Tableau Desktop
Answer
1. Create a parameter to choose a month you want to display.2. Create the following calculations.
[This Year]
SUM(IF
DATETRUNC('month',[Order Date])=[Choose a month]
THEN [Sales] END)
[Previous Year]
LOOKUP(SUM(IF
DATEADD('day',-364,[Choose a month])<=[Order Date]
AND
DATEADD('day',-364,DATEADD('month',1,[Choose a month])-1)>=[Order Date]
THEN [Sales] END),
DATEADD('year',1,
DATEADD('day',-364,[Choose a month])
)-[Choose a month]
)
3. Drag [Measure Names] to [Filters] and choose [This Year] and [Previous Yeas]
4. Drag [DAY(Order Date)] to [Columns], [Measure Values] to [Rows], [Measure Names] to [Color]
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials