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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
SrinivasK
New Member

Calculate weighted average based on another field

I have product wise volume and certain budget allocated on it but need to find prorpotion of this budget by calculating share of volume in total volume.

I tried few variations of this - using Allselected or All because there were few filters working on this visual matrix table. But unable to get the result shown in weighted average column below. Can any expert help ?

 

Weighted Avg = 

var totalvol = calculate(sum(table[Vol]),All (table)),

Return

Sumx(

       All (table),

       Divide ((table[Vol]), totalvol) * (table[Budget]))

 

 

Ex: 

ProductVolBudgetWeighted Avg (Result) 
A2005012.5 ((200/800)*50)
B2005012.5
C2004812
D2004812
Total800  
2 ACCEPTED SOLUTIONS
ahadkarimi
Solution Specialist
Solution Specialist

Hi @SrinivasK , try this measure below, and if you encounter any issues, let me know.

Weighted Avg = 
VAR TotalVol = CALCULATE(SUM(Table[Vol]), ALL(Table))
RETURN
SUMX(
    Table,
    DIVIDE(Table[Vol], TotalVol) * Table[Budget]
)

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!

View solution in original post

SrinivasK
New Member

Thanks @ahadkarimi for your answer. I changed All to Allselected on Total var and it worked. I guess since there are filters applied, on the matrix, the allselected worked. 

 

View solution in original post

2 REPLIES 2
SrinivasK
New Member

Thanks @ahadkarimi for your answer. I changed All to Allselected on Total var and it worked. I guess since there are filters applied, on the matrix, the allselected worked. 

 

ahadkarimi
Solution Specialist
Solution Specialist

Hi @SrinivasK , try this measure below, and if you encounter any issues, let me know.

Weighted Avg = 
VAR TotalVol = CALCULATE(SUM(Table[Vol]), ALL(Table))
RETURN
SUMX(
    Table,
    DIVIDE(Table[Vol], TotalVol) * Table[Budget]
)

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.