Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I am trying to get a weighted average (as a total), that is, for each customer, :
sum(value * size) / sum(size)
Tthe value is just a measure that is (SumPerCustomer / Max_PerCustomer)
...If a customer has (3 , 1,7 ) the measure shall be 11 / 7
I get the desired result for the value but not for the averaged weight:
VAR Max_PerCustomer =
MAXX(
FILTER(
SUMMARIZE(
Revenue
,'Customer'[Customer]
,'Center'[Center]
)
, SUM(Revenue[Revenue]) > 0
)
, SUM(Revenue[Revenue])
)
VAR SumPerCustomer =
CALCULATE(
SUM(Revenue[Revenue])
, FILTER(
SUMMARIZE(
Revenue
,'Customer'[Customer]
,'Center'[Center]
)
, SUM(Revenue[Revenue]) > 0
)
)
RETURN
SWITCH(
TRUE()
,ISINSCOPE('Customer’[Customer]) , DIVIDE(SumPerCustomer, Max_PerCustomer)
,DIVIDE ( SUMX('Customer’, DIVIDE(SumPerCustomer, Max_PerCustomer) * SumPerCustomer), SUMX('Customer’, SumPerCustomer),0)
)
Any help is appreciated, I can't figure why it does the wrong calculation
@Anonymous
could you pls provide the sample data and expected output?
Proud to be a Super User!
@Anonymous , try to add values and check
measure =
var _sel = selectedvalue(Param[Param])
var _cnt =distinctcount(Geography[locations])
var _1= CALCULATE([Sales],TOPN(_sel,all(Geography[locations]),[Sales],DESC),VALUES(Geography[locations]))
var _2= CALCULATE([Sales],TOPN(_cnt,all(Geography[locations]),[Sales],asc),VALUES(Geography[locations]))
return
if(_sel =0 || not(isfiltered(Param[Param])) , _2, _1)
calculate(
SWITCH(
TRUE()
,ISINSCOPE('Customer'[Customer]) , DIVIDE(SumPerCustomer, Max_PerCustomer)
,DIVIDE ( SUMX('Customer', DIVIDE(SumPerCustomer, Max_PerCustomer) * SumPerCustomer), SUMX('Customer', SumPerCustomer),0)
), values('Customer'[Customer]))
I can' quiet follow , what do you mean?
@Anonymous , values is group data at a level
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 54 | |
| 43 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 123 | |
| 106 | |
| 44 | |
| 32 | |
| 24 |