Forum Discussion
jayjani
6 years agoHelper I
YoY Calulation not working
Hello, I am trying to calculate YoY and QoQ for my data and tried various different techniques but to no avail. I am able to correctly mark Previous Year but whenever I try to calculate Sales data...
- 6 years ago
Hi, jayjani
I'd like to suggest you create a Date table. I created data to reproduce your scenario.
Table:
Calendar:
Calendar = CALENDARAUTO()There is a relationship between two tables.
You may a measure as follows.
LY Sales1 = IF( ISFILTERED('Calendar'[Date].[Year]), CALCULATE( SUM('Table'[Sales]), DATESYTD(SAMEPERIODLASTYEAR('Calendar'[Date])) ) ) LY Sales2 = var _year = SELECTEDVALUE('Calendar'[Date].[Year]) return CALCULATE( SUM('Table'[Sales]), FILTER( ALLSELECTED('Table'), YEAR('Table'[Date]) = _year-1 ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
6 years agoCommunity Champion
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
That said, See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008