The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there
I have 3 columns of data 'Date', 'Institution', and 'Sales'. I am wanting to calculate a measure that give the year on year % change in sales for each institution.
I have been using quick measure for year over year change functin for aggregate sales, but having an issue with finding code that incorporates another column, (i.e. instituion) so as to present % changes for each institution year on year.
Solved! Go to Solution.
Hi,
The general structure for YoY % change calculations is as follows:
VAR LastYear = CALCULATE ( selectedmeasure(), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) ) RETURN DIVIDE(selectedmeasure()-LastYear,LastYear)
This is an calculation group example so replace "selectedmeasure" with yout calculation logic. So for example something like SUM('Sales'[values]). If your Sales table has a relationship to 'instittututions' and 'calendar' this code should also account for those dimensions.
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Thanks for your response. Although this calculation is returning all YoY% figures as 0.00%.
This is the code I used.
Hi,
The general structure for YoY % change calculations is as follows:
VAR LastYear = CALCULATE ( selectedmeasure(), SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) ) RETURN DIVIDE(selectedmeasure()-LastYear,LastYear)
This is an calculation group example so replace "selectedmeasure" with yout calculation logic. So for example something like SUM('Sales'[values]). If your Sales table has a relationship to 'instittututions' and 'calendar' this code should also account for those dimensions.
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Thanks for your response ValtteriN. Although this calculation is returning all YoY% figures as 0.00%.
This is the code I used.
User | Count |
---|---|
13 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
13 | |
8 | |
8 |