Any way to get the calculation in DAX

Hey All,
Please is there any way i can replicate this calculation on DAX?
GAP = 100 - MOBILITY%
Mobility is a measure already created, but to get GAP, you have to subtract 100 from Mobility%.
I tried using this formula but my results were off. Pls i need help on this.
@BrianJ
Attached are 3 screenshots,

  1. The picture of my wrong result.
  2. The DAX Calculation.
  3. Screenshot of what the result should look like.



    Thanks

Hello @Egbejiogu,

Thank You for posting your query onto the Forum.

Well the percentages (%) figures in actual are always in decimals i.e. for example 0.129 and than using the “%” format we convert them into the actual % figures i.e. for example 129.13%.

So now, in order to deduct the 100 from your mobility measure just simply write the formula as provided below -

GAP = 1 - [Mobility]

Hoping you find this useful and will help you in your analysis. :slightly_smiling_face:

Thanks and Warm Regards,
Harsh

1 Like

@Harsh hanks for your prompt reply, I tried that and got same result.
So confusing now.

Hello @Egbejiogu,

Could you please upload the PBIX file? So that members of the forum can assist you in a better and efficient manner.

Since without the file it’ll only consume the members time through guess work process.

Thanks and Warm Regards,
Harsh

@Egbejiogu,

As always, @Harsh is absolutely spot on. Your incorrect results could be due to: problems with your [Mobility] measure; problems with the context in which you’re applying it; and/or problems with your data model. Without seeing your PBIX file it’s impossible to tell which one is the culprit.

In addition, I noticed something in your earlier post – a misinterpretation of the CALCULATE function. I think CALCULATE gives so many people trouble not because it’s that difficult, but because it is so poorly named. CALCULATE actually has little to do with calculations directly, but instead changes the context of the calculation occurring. Thus, whenever I see CALCULATE, I mentally have trained myself to substitute CHANGECONTEXT() (a function that doesn’t actually exist, but should - in the same way that REMOVEFILTERS can be used synonymously with ALL (in some cases…), but is much clearer as to what it is doing).

In your case above of CALCULATE(100), no context is being changed so CALCULATE isn’t doing anything, which is why Harsh removed it (also because CALCULATE on a constant doesn’t do anything either). Sam has a whole series of outstanding videos on CALCULATE in the Mastering DAX course:

image

Understanding context and the way CALCULATE can be used to manipulate it is probably THE key concept necessary to write proper DAX.

I hope this is helpful.

  • Brian
3 Likes

Thanks @BrianJ and @Harsh both suggestions was helpful, My mobility formula was wrong
1- Mobility worked.
Thanks

1 Like

Hello @Egbejiogu,

You’re Welcome. :slightly_smiling_face:

We’re glad that the formula worked for you and you found it useful.

Thanks and Warm Regards,
Harsh

1 Like

Hi @Egbejiogu, did the response provided by @Harsh and @BrianJ help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query. Thanks!