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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Nanakwame
Helper II
Helper II

How to Calculate Weighted Average with Sales and Margin

Hi Power BI Experts,

 

I am looking to create the weighted average instead of regular average. I do have sales budget with margin budget available for the calculation. i am looking to get the weighted average of either the margin or sales. The idea is that each warehouse sales budget is not the same therefore it should be considerd for the weighted average calculation.  Please see the table below. 

Nanakwame_0-1634679364122.png

 

 

 

2 ACCEPTED SOLUTIONS

The basic pattern looks like this:

AvgMargin =
DIVIDE (
    SUMX ( Table1, Table1[Margin] * Table1[Sales] ),
    SUMX ( Table1, Table1[Sales] )
)

 

View solution in original post

If you want the average sales weighted by margin rather than average margin weighted by sales, swap the roles of Margin and Sales. In this case, that can be done just by changing the denominator to use Margin instead of Sales (since they're both already present in the numerator, swapping the columns there doesn't change anything since multiplication is commutative).

View solution in original post

5 REPLIES 5
AlexisOlson
Super User
Super User

What is the result you're expecting? Average Margin weighted by Sales?

Yes average Margin weighted by sales or vice versa. 

The basic pattern looks like this:

AvgMargin =
DIVIDE (
    SUMX ( Table1, Table1[Margin] * Table1[Sales] ),
    SUMX ( Table1, Table1[Sales] )
)

 

Thank you Sir. That worked. What if i will like the weighted average amount. do i just use the same function but different denominator?

If you want the average sales weighted by margin rather than average margin weighted by sales, swap the roles of Margin and Sales. In this case, that can be done just by changing the denominator to use Margin instead of Sales (since they're both already present in the numerator, swapping the columns there doesn't change anything since multiplication is commutative).

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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