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
PC2022
Helper III
Helper III

Weighted Average

Good day,

 

I need to calculate weighted avg for PayItemNo and need help with dax for it.

"Average vs low" number represents a number i calculated based on submitted bids. In the table below (i exported it into excel from query editor) there are multiple instances of the same "pay item". First, they need to be grouped and then calculate weighted avg: total qty of "pay item" * sum of "average vs low" / total qty of "pay items". Thank you.

 

PC2022_1-1699990611563.png

 

 

2 REPLIES 2
PC2022
Helper III
Helper III

Thank you!

mohgh
Regular Visitor

WeightedAvg =
DIVIDE(
SUMX(
VALUES('YourTable'[PayItemNo]),
SUMX(
FILTER('YourTable', 'YourTable'[PayItemNo] = EARLIER('YourTable'[PayItemNo])),
'YourTable'[Qty] * 'YourTable'[AverageVsLow]
)
),
SUMX(
VALUES('YourTable'[PayItemNo]),
SUMX(
FILTER('YourTable', 'YourTable'[PayItemNo] = EARLIER('YourTable'[PayItemNo])),
'YourTable'[Qty]
)
)
)

 

 

This formula uses the SUMX function to iterate over the unique values of 'PayItemNo', then within each iteration, it calculates the sum of the product of 'Qty' and 'AverageVsLow', and divides it by the sum of 'Qty' for that 'PayItemNo'. Finally, it divides the overall sum by the overall sum of 'Qty' for all 'PayItemNo' values.

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.