Forum Discussion
ChrisCoxhill
2 years agoFrequent Visitor
Previous Year comparison - account for partial current Year
Hi, Please can I have assistance when trying to write DAX comparing to the prior year? When Month is in scope, and for full prior years, the calculation returns the appriopriate amount for "Prev...
- Anonymous2 years ago
Hi ChrisCoxhill , amitchandak thank you for your prompt reply!
Please try the following measure to show only the month totals for the same period last year:Previous Year 2 = CALCULATE( SUM('SW Energy'[Cost]), FILTER( SAMEPERIODLASTYEAR('Date'[Date]), MONTH('Date'[Date]) <= MONTH(MAX('SW Energy'[Invoice Date])) ) )Result:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ChrisCoxhill
2 years agoFrequent Visitor
Hi amitchandak sorry I think I have to "mention" you. After reviewing the logic of your calc, you are evaluating what to do when Month is in scope vs when not (Year), if I've understood correctly.
I hope you can see now what I'm trying to do is JUST for 2024 (the latest year) - when Year IN SCOPE, the comparison amount shouldn't be the full amount, it should be based on YTD
Again, thanks a lot for any assistance!