Thanks,for your timely help.
Your logic is awesome and it solved my issue.
Could you please explain the logic you have implemented.
Can i ask for a favor. I have implemented YOY and attached workbook for Tableau 10.2. Could you please check.
Here, upto March (upto March 2018)is populated in filters. I am calculating YOY for previous years based on January, February and March as selected on filters. Is my logic correct.
YOY-Community.twbx 65.7 KB
The logic is that:
- Get months from all dates in the data
- Find all months in 2018, it may fall into 2 different scenarios, from your description it is not 100% clear, because the approach will be different. My solution is for 1st scenario. For both I would use LoD
- Current year, so we will use comparison with TODAY() year
- Max year in the data, so we have to find max year in the data regardless of TODAY() year
- Compare each date months from the 1st step with months from 2nd step (range), and if inside range then return name of month, otherwise it shows null
- Plus it really matter how looks your visualisation as different dimensions in the view will allow to simplify or add complexity to calcs
- The logic is achievable with table cacls also, depends on viz itself, especially if you have months in the view
Yeah, seems YoY works correctly in both ways (for a chart with years or years and months). I would test only if you add some extra dimensions like other firmnames, as you might to restart every firmname.