Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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.

  • 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

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft 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

    • Anonymous's avatar
      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.