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! Learn more

Reply
kirbynguyen
Helper II
Helper II

Weighted Average DAX

Hello,

 

I am trying to use a measure to find the weighted average based on the values in another column per product. My data looks like this:

 

Product  Date  Value  WeightValue

A

1/1/2021101
A1/2/2021202
A1/3/2021303
B1/1/2021404
B1/2/2021505
B1/3/2021606
C1/1/2021707
C1/2/2021808
C1/3/2021909

 

I want to visualize this in a line and the weighted average should be dynamic, so whenever I select 2 products, the weighted average would only take into account the products that are selected.

 

For ex, if I select Product A and Product C, the value I should get for 1/1/2021 is [10 * (1/(1 + 7))] + [70 * (7/(1 + 7))] = 62.5.

if I select Product B and Product C, the value I should get for 1/1/2021 is [40 * (4/(4 + 7))] + [70 * (7/(4 + 7))] = 59.091. 

 

Thanks for you help in advance.

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@kirbynguyen 

Give something like this a try, it's 3 measures but that keeps in clean in my mind.

1. Calculate all the weighted values

 

Weighted Values = SUMX ( 'Your Table', 'Your Table'[Value] * 'Your Table'[WeightValue] )

 

2. Get the sum of all the weights

 

Total Weights = SUM ( 'Your Table'[WeightValue] )

 

3. Get the weighted average value

 

Weighted Average Value = DIVIDE ( [Weighted Values], [Total Weights] )

 

 

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

@kirbynguyen 

Give something like this a try, it's 3 measures but that keeps in clean in my mind.

1. Calculate all the weighted values

 

Weighted Values = SUMX ( 'Your Table', 'Your Table'[Value] * 'Your Table'[WeightValue] )

 

2. Get the sum of all the weights

 

Total Weights = SUM ( 'Your Table'[WeightValue] )

 

3. Get the weighted average value

 

Weighted Average Value = DIVIDE ( [Weighted Values], [Total Weights] )

 

 

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.

Top Solution Authors