By: Eric Parker
Eric Parker lives in Seattle and has been teaching Tableau and Alteryx since 2014. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email. You can follow him on LinkedIn or sign up for a Tableau Office Hour to work with him directly!
Comparing one time period to another is a common use case in Tableau. In our experience, one of the best ways to do that is to overlay one on top of the other. The question is, how do you do that dynamically for both a current and comparison period?
Check out this video for one of our favorite homegrown solutions where you create a custom date field and a custom value label which allows you to overlay two time periods for comparison!
Need help with Tableau? Sign up for an office hour to work with Eric! You can also check out our upcoming classes for a Tableau deep dive!
Related Resources
Calculations
[Selected / Prior Period Labels]
IF [Order Date ] >= [Start Date Parameter] AND [Order Date ] <= [End Date Parameter]
THEN "Selected"
ELSEIF [Order Date ] >= DATEADD('year',-1,[Start Date Parameter])
AND [Order Date ] <= DATEADD('year',-1,[End Date Parameter])
THEN "Prior"
ELSE "Not in Range"
END
[Order Date_Adjusted]
DATE(
IF [Selected / Prior Period Labels] = "Selected" THEN [Order Date ]
ELSEIF [Selected / Prior Period Labels] = "Prior" THEN DATEADD('year',1,[Order Date ])
END
)
Want to keep learning foundational skills in Tableau? Sign up for our weekly newsletter so you never miss new blog posts, videos and events!