Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sneevand
Frequent Visitor

YOY qty Measure, Dynamic

Hi Guys,

 

We have below data

yr      qty   salamt

2021 100  20000

2020 2     200

2019 3      99

 

We would like to get AVG price yoy

2021 =20000/100= 200

2020 =200/2= 100

2019 =99/3= 33

 

We achieved above by simple dax

CY=calculate(salamt/qty,dateadd(dimdate,1,Year)) 

PY =dateadd(dimdate,1,Year) replaced 1 with -1

PY-1=dateadd(dimdate,1,Year) replaced 1 with -2

 

Change Per Year= cy-py/qty py

dynamically for all years

 

but what if have to do it for 20 yrs [By above method i end up creating 20 measures], i dont want to create 20 measures, Can i pass middle value as dynamic paramter based on year filter? or Some Dummy table?

 

Regards,

Sneevand

 

 

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @sneevand ,

 

Please refer to these thread:

https://community.powerbi.com/t5/Desktop/YoY-Calculations/m-p/342299 

https://community.powerbi.com/t5/Desktop/YoY-Qty-Measure/m-p/1604993 

Then use the year slicer to dynamically display the comparison with the previous year.

If the problem persists,could you share the sample pbix via cloud service like onedrive for business?

Please remove any sensitive data before uploading.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@sneevand not sure why you will do that, you just need to create 3 measure and you should use date dimension and then use previousyear dax function to get value for the previous year, which means whatever year you are looking at, you will get previous year value.

 

There are tons of posts on time intelligence and previous year calculations.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.