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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.