Forum Discussion
Anonymous
4 years agoNot 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 ba...
- 4 years ago
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
johncolley
4 years agoSolution 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
4 years agoNot applicable
Sorry, I'm not super familiar with PowerBI is that a DAX function? Where would I use that?
- Anonymous4 years agoNot applicable
I think I figured it out. I'm assuming that it would be put into a new measure 🙂
- johncolley4 years agoSolution Sage
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!