Forum Discussion
kirbynguyen
5 years agoHelper 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 ...
- 5 years ago
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] )
jdbuchanan71
5 years agoSuper User
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] )