Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Dax error

I need your help with that calculation , firstly I used dax to divid CY by LY to yield (Value Divide) , as shown below

then used another dax to minus value divide from 1 (value divide - 1) as shown below

but the rewult was not good , it minus all rows not only the filtered one and yield many rows with -100%

I think there is a mistake in my dax (value divide -1) what should I edit?

 

2 Replies

  • AntrikshSharma's avatar
    AntrikshSharma
    Community Champion

    Anonymous  Use this 

    =
    IF ( [Value CY] <> BLANK () && [Value LY] <> BLANK (), [Values Divide] )
    

     

  •  

    [Brand PPG] =
    var __division = [Value Divide]
    return
        IF( __division, __division - 1 )

     

    The above formula says: If __division is BLANK or 0, do not display (__division - 1). This works because 0 and BLANK() are treated as False when used in a bool context.

     

    If you want to get max speed from the calculation, you'd do this:

     

    [Brand PPG] =
    var __division = [Value Divide]
    var __shouldCalc = DIVIDE( __division, __division )
    return
        __shouldCalc * (__division - 1)

     

    The above does not use IF and hence has the potential to only use Storage Engine, hence maximum speed.