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
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
Employee
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
Employee
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
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.