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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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