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
Silvia_Gulu_BXL
Frequent Visitor

Weighted moving average

Hello, I have a table with the demand per month:

Silvia_Gulu_BXL_0-1706168420376.png

 

I want to calculate the moving average but with weighted average like below:

Forecasted_demand=(M1*1+M2*2+M3*3)/6

(M1: 3 months ago, M2: 2 months ago, M3: previous month)

 

Could you help to write the DAX measure to get it?

 

Thank you in advance!

 

Kind regards,

Silvia

 

 

 

1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

Hello @Silvia_Gulu_BXL 

 

output : 

Daniel29195_1-1706204831613.png

kindly use the following measure : 

moving weighted average =
 var current_month =  max(Table30[date])

 var M3 =  
 CALCULATE(
    SUM(Table30[actual demand]),
    Table30[date] = EDATE(current_month,-1)
 )
var M2 =
 CALCULATE(
    SUM(Table30[actual demand]),
    Table30[date] = EDATE(current_month,-2)
 )
var M1 =
 CALCULATE(
    SUM(Table30[actual demand]),
    Table30[date] = EDATE(current_month,-3)
 )


var resl = ( (M3*3) +  (M2*2) + (M1*1)) / 6


RETURN resl

 Daniel29195_2-1706204847378.png

 

 

 let me know if this works for you . 

 

If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. I would appreciate hitting that kudos button 👍🤠

 

View solution in original post

2 REPLIES 2
Daniel29195
Super User
Super User

Hello @Silvia_Gulu_BXL 

 

output : 

Daniel29195_1-1706204831613.png

kindly use the following measure : 

moving weighted average =
 var current_month =  max(Table30[date])

 var M3 =  
 CALCULATE(
    SUM(Table30[actual demand]),
    Table30[date] = EDATE(current_month,-1)
 )
var M2 =
 CALCULATE(
    SUM(Table30[actual demand]),
    Table30[date] = EDATE(current_month,-2)
 )
var M1 =
 CALCULATE(
    SUM(Table30[actual demand]),
    Table30[date] = EDATE(current_month,-3)
 )


var resl = ( (M3*3) +  (M2*2) + (M1*1)) / 6


RETURN resl

 Daniel29195_2-1706204847378.png

 

 

 let me know if this works for you . 

 

If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. I would appreciate hitting that kudos button 👍🤠

 

@Daniel29195 Many thanks for the solution! I have marked it as "accepted".

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.