cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

## Weighted Average Measures Help

Please see the sample data below.  I have the first three columns in my source data but I need help with the weighted columns.  I am trying to create three measures.  One that will calculate a Weight (rev per customer/total rev ), Weighted GM (Weight * GM), and Weighted GM% ( GM / Rev).  Also, would I be able to filter these in a chart and still have accurate numbers?  I appreciate the assistance!

1 ACCEPTED SOLUTION
Super User

Hi,

Write these measures

Gross margin = sum(Data[GM[)

Revenue = sum(Data[Rev])

Revenue across all customers = calculate([Revenue],all(Data[Customers]))

Weight = divide([Revenue],[Revenue across all customers])

Weighted GM = SUMX(Values(Data[Customers]),[Weight]*[Gross margin])

Weighted GM % = divide([Weighted GM],[Revenue])

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
2 REPLIES 2
Frequent Visitor

Thank you, this was very helpful!

Super User

Hi,

Write these measures

Gross margin = sum(Data[GM[)

Revenue = sum(Data[Rev])

Revenue across all customers = calculate([Revenue],all(Data[Customers]))

Weight = divide([Revenue],[Revenue across all customers])

Weighted GM = SUMX(Values(Data[Customers]),[Weight]*[Gross margin])

Weighted GM % = divide([Weighted GM],[Revenue])

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.