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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

calculating weighted average

Hello all ,

 

I want to have a dax formula to calculat the weighted average for the next scenario.

 

i have 10 participants , which 8 participants scored a 1 and 2 participants scored a 4.

 

So based on this the weigted average would be =  8 x 1 + 2 x 4 = 8 + 8 = 16 / 10 = 1.6

2017-10-24 21_48_12-test gewogen gemiddelde - Excel.png

 

 

Which DAX formula should i use to get 1.6?

 

Thanks in advances.

 

Rega

 

 

1 ACCEPTED SOLUTION
erik_tarnvik
Solution Specialist
Solution Specialist

If Scores is your table then 

Measure = SUM(Scores[Score])/COUNTROWS(Scores)

should do it. Your formula is equivalent to just summing up the scores column and divide by number of rows, right?

View solution in original post

2 REPLIES 2
Molotch
Helper II
Helper II

Not sure I follow you. Why would you go through the trouble grouping the 1:s and 4:s and then calculate a weighted average when you have all the individual scores and can just use a straight average?

 

If you have the average and weight in a table you can use SUMX to do a row by row calculation where you multiply your average with the weight and then divide the result by the SUM of the weights. That will calculate the weighted average. Ie SUMX(table, average*weight)/SUM(weight).

 

It can be quite slow though since it iterates all rows in the table.

erik_tarnvik
Solution Specialist
Solution Specialist

If Scores is your table then 

Measure = SUM(Scores[Score])/COUNTROWS(Scores)

should do it. Your formula is equivalent to just summing up the scores column and divide by number of rows, right?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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