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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Calculating average values based on filter

I want to calculate one total weighted average based on all entries in a table that responds to user selected filters on the table.

In these tables the quantity is the weight and hardiness is the base value. 

So for table 1 the weighted avg would be 4.1785

MulberyPie_0-1652903024512.pngMulberyPie_2-1652903818377.png

 

But for table 2 the overall average would be 3.625

MulberyPie_1-1652903055558.png MulberyPie_1-1652903783694.png

How could I show a weighted average for all fields in a filtered table?

 

 

1 ACCEPTED SOLUTION
johncolley
Solution Sage
Solution Sage

Hi @Anonymous ,

 

Assuming I have your logic right - I think the answer you are expecting is 4.107 when nothing is selected? If so the following should work.

Weighted Avg = 
Var Plantvalue = SUMX(Plants, Plants[Quantity]*Plants[Hardiness ])
Var Quantity = SUM(Plants[Quantity])
Var result = Plantvalue / Quantity
Return
result

 

View solution in original post

4 REPLIES 4
johncolley
Solution Sage
Solution Sage

Hi @Anonymous ,

 

Assuming I have your logic right - I think the answer you are expecting is 4.107 when nothing is selected? If so the following should work.

Weighted Avg = 
Var Plantvalue = SUMX(Plants, Plants[Quantity]*Plants[Hardiness ])
Var Quantity = SUM(Plants[Quantity])
Var result = Plantvalue / Quantity
Return
result

 

Anonymous
Not applicable

Sorry, I'm not super familiar with PowerBI is that a DAX function? Where would I use that?

Anonymous
Not applicable

I think I figured it out. I'm assuming that it would be put into a new measure 🙂

Hi @Anonymous, sorry should have stated in my original message! Yes it's a new measure.

 

Hope the measure helped, if it addressed your problem please mark it as a solution!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.