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
opittaluga
Frequent Visitor

Working with different levels of aggregations on one measurement

Hello, I bring a hard task, hope something can help me. I will explain the simple task on excel first.

I start with a simple table like the picture below:

1.png

With pivot tables I summarize the amount of purchase and the weights. And with those two tables I can estimate weighted average price and variance like in the following pictures.

2.PNG 

In Power BI the weighted price it was faster to calculate, I just wrote the following measurement

Precio Prom. Pond. = sum(Tabla1[Purchase Amount])/sum(Tabla1[Weight])

Then, with a Matrix I obtain the same result for the weighted prices.

 

3.png

 

My problem is with the variance. How can I use a measurement's value for a vendor Like 0.67 (A,January) and subtract a measurement total like 0.47.4.PNG

 

It is the same measurement but with different level of aggregations. I tried different formulas but without success.

The idea is that if you use slicer to filter dates or vendors the table change and the varices as well.

If somebody pass for something similar it will be great if you can share it. THANK!

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

Hi @opittaluga,

 

Based on my test, you should be able to use the formula below to create a measure to calculate total [Precio Prom. Pond.], and then use it in other calculations in your scenario. Smiley Happy

Total Precio Prom. Pond. =
CALCULATE (
    SUM ( Table1[Purchase Amount] ) / SUM ( Table1[Weight] ),
    ALL ( Table1[Vendor] )
)
Measure = [Precio Prom. Pond.] - [Total Precio Prom. Pond.]

r2.PNG

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @opittaluga,

 

Based on my test, you should be able to use the formula below to create a measure to calculate total [Precio Prom. Pond.], and then use it in other calculations in your scenario. Smiley Happy

Total Precio Prom. Pond. =
CALCULATE (
    SUM ( Table1[Purchase Amount] ) / SUM ( Table1[Weight] ),
    ALL ( Table1[Vendor] )
)
Measure = [Precio Prom. Pond.] - [Total Precio Prom. Pond.]

r2.PNG

 

Regards

Thank you! The formula works great.

opittaluga
Frequent Visitor

Hello, I bring a hard task, hope something can help me. I will explain the simple task on excel first.

I start with a simple table like the picture below:

1.png

With pivot tables I summarize the amount of purchase and the weights. And with those two tables I can estimate weighted average price and variance like in the following pictures.

2.PNG 

In Power BI the weighted price it was faster to calculate, I just wrote the following measurement

Precio Prom. Pond. = sum(Tabla1[Purchase Amount])/sum(Tabla1[Weight])

Then, with a Matrix I obtain the same result for the weighted prices.

 

3.png

 

My problem is with the variance. How can I use a measurement's value for a vendor Like 0.67 (A,January) and subtract a measurement total like 0.47.4.PNG

 

It is the same measurement but with different level of aggregations. I tried different formulas but without success.

The idea is that if you use slicer to filter dates or vendors the table change and the varices as well.

If somebody pass for something similar it will be great if you can share it. THANK!

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.

Top Solution Authors
Top Kudoed Authors