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
mdennis05
Regular Visitor

DAX Week to week difference to calculate an average usage

I am developing an inventory dashboard. Each week there will be a weekly count. I would like to calculation the average usage. I know I need to calculate the difference from each week's count for an item then average this. However, I am getting nowhere on it.

 

Last Week = CALCULATE(DISTINCTCOUNT('Count'[Product Name]), 'Calendar'[Week Num] = MAX('Calendar'[Week Num])-1)


Weekly Average = AVERAGEX(SUMMARIZE('Count','Count'[Quantity], "toAverage",[Last Week]),[Last Week])

This is returning 1 for values. which is correct then blank for others that should have a value.

My end goal is to use this as a minimum ordering level for 2 months. Multiplying the average weekly usage by 8.

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @mdennis05 try v2 below

Last Week v2 =

VAR __week_filt= MAX('Calendar'[Week Num])-1

CALCULATE(DISTINCTCOUNT('Count'[Product Name]), 'Calendar'[Week Num] = __week_filt)


Weekly Average = AVERAGEX(SUMMARIZE('Count','Count'[Quantity], "toAverage",[Last Week]),[Last Week])





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @mdennis05,

Thanks for reaching out to the Microsoft fabric community forum.

It looks like you want to calculate the average of usage from your inventory dashboard. As @bhanu_gautam and @some_bih both responded to your query, please go through their responses and mark the helpful reply as solution.

 

I would also take a moment to thank @bhanu_gautam and @some_bih, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

 

If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

Best Regards,
Hammad.
Community Support Team

 

If this post helps then please mark it as a solution, so that other members find it more quickly.

Thank you.

Anonymous
Not applicable

Hi @mdennis05,

As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.

If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.


If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.

Anonymous
Not applicable

Hi @mdennis05,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily.


Thank you.

Anonymous
Not applicable

Hi @mdennis05,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

bhanu_gautam
Super User
Super User

@mdennis05 Try using

 

Calculate the previous week's count:

LastWeekCount =
CALCULATE(
SUM('Count'[Quantity]),
'Calendar'[Week Num] = MAX('Calendar'[Week Num]) - 1
)

 

Calculate the difference from the previous week:

DAX
WeekDifference =
SUM('Count'[Quantity]) - [LastWeekCount]

 

Calculate the average of these differences:

DAX
AverageWeeklyUsage =
AVERAGEX(
SUMMARIZE(
'Count',
'Calendar'[Week Num],
"WeeklyDiff", [WeekDifference]
),
[WeeklyDiff]
)

 

Calculate the minimum ordering level for 2 months (8 weeks):

MinOrderingLevel = [AverageWeeklyUsage] * 8




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






some_bih
Super User
Super User

Hi @mdennis05 try v2 below

Last Week v2 =

VAR __week_filt= MAX('Calendar'[Week Num])-1

CALCULATE(DISTINCTCOUNT('Count'[Product Name]), 'Calendar'[Week Num] = __week_filt)


Weekly Average = AVERAGEX(SUMMARIZE('Count','Count'[Quantity], "toAverage",[Last Week]),[Last Week])





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.