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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
ellevy
Helper I
Helper I

weight average

Hello

i have a table of the following stracture

 

ID  | Q1

W   |  1

Z   |  2

T   |  2

X   |  4

 

i want to calculate to weight avarage of those who answerd Q1 (the can answer numbers between 1 to 5)

for the above example the calculation should be (1*1+2*2+4*1) / (1+2+2+4)  = 1  ( i Bold the weights. the weights are actuly the number the ID has answerd) .

in excel i can do this using sumproduct  , but i get trouble with powerbi for this...

i also have more then 10 coulmns of Questions . is there easy way for doing this weight avarage measure or should i write measure for each Question?

thanks !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ellevy,

It sounds like you want to apply multiple aggregates to your expression.
Maybe you can try to add a variable with summarize function to apply the first level aggregate and use the iterator function to do the second summary of these results.

Measure Totals, The Final Word 

If you confused about the coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@ellevy , This sample does noes represent a case of weighted Average.

This is also as good as

sum(Table[q1])/sum(Table[Q1])

 

 

If you want to multiple to column in a row your can do in sumx

 

sumx(Table, [Q1] *[Q2])

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks, i used a variation of  - sumx(Table, [Q1] *count(ID) ) / SUM (ID) which is good for my case. the weights are the numbers in each Q coulmn (Q1,Q2...) , the numbers i wish to weight are the "count(ID) "

Anonymous
Not applicable

Hi @ellevy,

It sounds like you want to apply multiple aggregates to your expression.
Maybe you can try to add a variable with summarize function to apply the first level aggregate and use the iterator function to do the second summary of these results.

Measure Totals, The Final Word 

If you confused about the coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.