Handle blank value in Complex expression IF condition in PowerBi

261 views Asked by At

I am writing a calculated column of the form

Column = IF( ISBLANK(ComplexExpression),0, ComplexExpression)

Does PowerBi recompute ComplexExpression twice?

1

There are 1 answers

1
alejandro zuleta On

It seems the expression is not computed twice, if the conditional is evaluated to True only the true branch expression will be evaluated.

You can test it by doing two nested IFs.

NewColumn =
IF(
  [MyColumn]=1,
  4/2,
  1/IF([MyColumn]<>1,1,"A")
)

In the above expression, the outer IF conditional is evaluated and if it is true, the result is 2 (4/2), so the false branch expression is not evaluated since it produces a #ERROR because it evaluates to 1/"A" which is undetermined.

MyColumn    NewColumn  
   1            2    --> If the false branch would be evaluated it'd produce an #ERROR
   2            1
   3            1
   1            2    --> If the false branch would be evaluated it'd produce an #ERROR

Let me know if this helps.