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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jessicarocha
Helper IV
Helper IV

Calculate division per week based on a cumulative sum and average for the last x weeks

Hello, 

 

my dataset is on a weekly base. I need to create a formula that uses the cumulative sum for the last completed 52 weeks of the comsumption and divides by the average of the stock for the last 52 weeks. The goal is to create the inventory turnover rate.

 

Example: 

 

Currently, we are on week 35 of 2024 (2024W35). Thus, I want to calculate the sum the comsumption from 2024W34 to 2023W35 (last 52 complete weeks). Then I want to do the average of the stock for the same time period. Then divide the sum of the comsumption by the average of the stock in order to obtain the inventory turnover rate.

jessicarocha_1-1724682700336.png

jessicarocha_2-1724682728639.pngjessicarocha_3-1724682755555.png

 

During week 33, the time period changes to 2024W33 to 2023W34. During week 32, my time period changes to 2024W32 to 2023W33.

 

I also want to make sure that when there is not enought weeks (52) to calculate the cumulative sum or average, the result is empty. 

 

In excel, I create the formulas as I need (average_52_weeks_stock, sum_comsumption, inventory_turnover_rate). However, I am unable to do this in power bi. I don't even know from where to start. Could you please help me?

 

Dummy Power BI and Excel: 

 

PB and excel link 

1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

ThxAlot_0-1724685561570.png

ThxAlot_1-1724685581810.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

1 REPLY 1
ThxAlot
Super User
Super User

ThxAlot_0-1724685561570.png

ThxAlot_1-1724685581810.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors