Year-over-year (YOY) is the comparison of one period with the same period from the previous year. A simple use case would be, comparison of profit made in a certain month compared to the same month last year.
In Tableau, enabling year over year analysis is quite easy.
Using this data, a simple question like, computing monthly cumulative profits for different years could be as follows;
Drag dimension field Order Date to the columns shelf, choose month as the level of detail
Drag measure field Profit to the rows shelf
Add a quick table calculation – Running Total
Drag dimension field Order Date to color shelf, choose level of detail as Year.
Note: This simple technique allows data consumers compare monthly performance or growth for different years. The technique presents the current year’s trend, against complete trends of the previous years.
But, suppose you would like to truncate the previous year’s trends to match that of the current year? Meaning trends of the previous year’s appear only up to the current year’s date part – Month of June for this case.
Compute maximum date ever recorded – latest date capture
(This formula computes the maximum date in the whole data source)
Compute month date part of the maximum date recorded
(Note, any other date part can be used in this function)
Compute month date part of the Order date
Create a Boolean function to enable filter the previous years trends based on the current year’s date.
Applying the above Boolean function as a filter & selecting ‘True’, we’ve;
Note: In the above figure, all the previous year’s months have been truncated to the latest year’s month – June. Meaning, other months trends can only be revealed as the latest date updates.
I hope this article was helpful to you.
Thanks for reading.