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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
opittaluga
Frequent Visitor

weighted average of a data inside a measurment

Hello community, I hope somebody can help me with this calculation.

 

The result I’m expecting is to show the weighted average of the price variation.

I will show how can I do this on power pivot and how far I’m with power BI.

For this I will need:

1) The weighted average price by quarter.

2) The price variation between the vendor’s price and the average price by quarter.  

3) And finally calculate the weighted average of those variations.

The Table

 

0.PNG

 

Excel

  • I calculated the average price and the total weight purchased per vendor per quarter by using a pivot table. To calculate the weighted average price.2.png

     

  • Then I calculated the price’ variation with a simple formula ((vendor price - average price) /average price.)

    3.PNG

     

     

 

  • Finally, I calculate the weighted average price variation using sum product formula.

 4.PNG

6.PNG

 

 

Power BI

  • I calculated the average price using the following formula:

Weighted Average Price = sum(Tabla1[Total])/sum(Tabla1[Amount (lb)])5.PNG

  • Then I obtained the price variation between the vendor’s price and the average price by using two formulas:

 

7.PNG

 

-Total weighted average = CALCULATE (SUM ( Tabla1[Total]) / SUM ( Tabla1[Amount(lb)] ); ALL ( Tabla1[Vendor ] ))

 

-Variation = ([Weighted Average Price]-[-Total weighted average])/[-Total weighted average]

 

  • 7.PNG

     

    Here is where I got stack. I don’t know how to get the weighted average of those variations. At the beginning, I thought it was the total  of the table, but it is not. The total on the table is a very different number.

Any ideas to solve this enigma?

 

Best

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@opittaluga

 

In this scenario, since you already put a measure into matrix, we can't define aggregation on a measure. And it's not possible to custom aggregation on Grand/Sub Total level.

 

For your requirement, it can't be achieved currently. Please vote a similar idea.

 

Regards,

View solution in original post

1 REPLY 1
v-sihou-msft
Microsoft Employee
Microsoft Employee

@opittaluga

 

In this scenario, since you already put a measure into matrix, we can't define aggregation on a measure. And it's not possible to custom aggregation on Grand/Sub Total level.

 

For your requirement, it can't be achieved currently. Please vote a similar idea.

 

Regards,

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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