Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

If statement for calculation heavy functions

Hi all, 

 

I am trying to make a if statement like this

 

If (measure >1000, "n/m", measure)

However, in this case the i wonder if powerbi is doing the measure calculation 2 times which may significantly slower the run time.

 

Have been thinking to use Min(1000, Measure) but i would like to return the result "n/m" if the result is bigger than 1000

 

Thanks!

 

  • You can avoid calcualting the mesure twice by assigning it to a variable.

    YourMeaures =
    VAR _Amount = [Measure] 
    RETURN IF ( _Amount > 1000, "n/m", _Amount )

1 Reply

  • You can avoid calcualting the mesure twice by assigning it to a variable.

    YourMeaures =
    VAR _Amount = [Measure] 
    RETURN IF ( _Amount > 1000, "n/m", _Amount )