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
Jeff_from_YYC
Regular Visitor

Calculate a new metric based on data from another column that needs to be dynamic as it rolls up

Hi there. This is my first post so if I'm not posting properly please let me know and I'll improve my forum etiquete 🙂

 

I'm building a model in PowerBi that will help us calculate emissions for our company. I'm pulling in data from many sources and then calculating the emissions using factors that I've uploaded to a table and reference using the "Related" function. Our industy uses "Emissions Intensity" as a KPI. Emissions intensity is "metric tonnes of CO2e emitted" divided by "volume produced". I've tried to add a column that just divides my "Ttl_CO2e" column by my "Vol" column but when i agg it up it sums the intensity metric, when really it should sum the Ttl_CO2e and divide that by the sum of the Vol. I also searched for a solution on here and there was one post where a measure was used by creating two "sum" measures and then dividing those. The issue is I'd like to be able to put it on a graph and filter down levels in the hierarchy and have it pull back the proper calculation for that level of aggregation.

 

So this is what a subset of my data might look like. Right now i have a divide function in there, but when i graph the data at say .... Jan 2022, it can't be the sum of the two, it needs to be the multiplication of what is being filtered. I hope this makes sense! 🙂

 

Thanks so much (I'll get better I promise!)

 

LocationTtl_CO2eVolIntensityDate
115100= divide [ Ttl_CO2e, Vol, 0]Jan 2022
22050 Jan 2022
11575 Feb 2022
21040 Feb 2022
3530 Feb 2022
460400 Feb 2022
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Jeff_from_YYC ,

I created a sample pbix file(see attachment), please check whether that is what you want. You can create a measure as below to get the intensity, the value will change dynamically base on the slicer selections:

Emissions Intensity = DIVIDE ( SUM ( 'Table'[Ttl_CO2e] ), SUM ( 'Table'[Vol] ), 0 )

yingyinr_0-1643161748227.png

If my understanding is not correct, please share some sample data(exclude sensitive data) and your expected result with backend logic and special examples just as suggested by @lbendlin . Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @Jeff_from_YYC ,

I created a sample pbix file(see attachment), please check whether that is what you want. You can create a measure as below to get the intensity, the value will change dynamically base on the slicer selections:

Emissions Intensity = DIVIDE ( SUM ( 'Table'[Ttl_CO2e] ), SUM ( 'Table'[Vol] ), 0 )

yingyinr_0-1643161748227.png

If my understanding is not correct, please share some sample data(exclude sensitive data) and your expected result with backend logic and special examples just as suggested by @lbendlin . Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
Super User
Super User

Welcome to the forums.

"from another column that needs to be dynamic"  - that is not possible. Columns are static.  You probably meant a measure.

 

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post (as you did already) or use one of the file services. Please show the expected outcome.

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.