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

Use value to calculate another value

I'm trying to do all of my calculations in PowerBI rather than having to dump it to Excel and do my calculations.

 

I need to calculate a percent of a total.  The base number (denominator) is the where the Feature is called NULL.  The description tells what the base item is.  In the example below, the base is Apples with qty of 20 and Grapes with qty of 50.

 

What I want to calculate is the percent of that number for all of the other features, like seed/seedless and down another level to color of the apple or grape.

 

 

FeatureDescriptionQtyPercent of total
NULLAPPLES20100%
SEED TYPE SEEDS735%
COLOR    RED420%
COLOR    GREEN315%
SEED TYPESEEDLESS1365%
COLOR    RED840%
COLOR    GREEN525%
NULLGRAPES50100%
SEED TYPE  SEEDS3570%
COLOR    RED3060%
COLOR    GREEN510%
SEED TYPE SEEDLESS1530%
COLOR    RED1224%
COLOR    GREEN36%

 

I can get the calculation to work at the first level, but cannot get it to go down to the subsequent levels.  For example, I created "Measure1" that sums the qty where the feature = "NULL".  Then I created "Measure2" = Qty / "Measure1".  This gives me the "percent of total" = 100%, 35% for "SEED TYPE = SEEDS" and 65% for "SEED TYPE = SEEDLESS".  This is as far as the calculation will go.  How do I get it to calculate all the way down to the color as well?

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@alfordtp,

 

You may take a look at the following post.

https://community.powerbi.com/t5/Desktop/Subtotal-Percentages/m-p/313658#M139139

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

This is close, but not fully what I'm looking for. 

 

In my example, there are a total of 50 GRAPES.  12 of those grapes are RED SEEDLESS GRAPES.  This is 24% of the total of 50 GRAPES.  How would you have Power BI calculate that?

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.