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
Anonymous
Not applicable

Max of a Measure Used In Another Measure

Hello,

 

I have a measure that calculates a perentage.  Lets say it looks like the table below:

ClientPercent
a45%
b20%
c5%
d1%

 

What I want to do is add another column that finds the max percentage overall and then subtracts it by each individual row.  So it would look like the following:

 

ClientPercentPercent Loss
a45%0
b20%-25%
c5%-40%
d1%-44%

 

Ideally it would also work when drilling into the data.  So if inside Client a, I have 3 workers who have their own percentage, I would like the calcuation to then work on their percentage EX:

 

ClientPercentPercent Loss

a

45% 
        Tom55%0%
        Jill35%20%
        Eve  20%35%

 

So Tom, Jill and Eve's data all together make up the 45% of client a, but as you can see, each has their own calculated percentage which can be higher than client a's.

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You can use a measure pattern like this to get your result.

 

Percent Loss = var vThisClient = [Percent]
var vMaxAll = MAXX(ALLSELECTED(Table[Client]), [Percent])

return vThisClient - vMaxAll

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

=[Percent]-maxx(all(data[workers]),[percent])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Employee
Employee

You can use a measure pattern like this to get your result.

 

Percent Loss = var vThisClient = [Percent]
var vMaxAll = MAXX(ALLSELECTED(Table[Client]), [Percent])

return vThisClient - vMaxAll

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

This worked perfect.  I did add a If(IsFiltered... to get it to work on the drill down, but I just used this formula twice for each case.  Thank you.

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.