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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.