Forum Discussion
IF statement performance
Hello,
I'm witnessing a performance issue for a quite simple measure used in a big table.
If I use this measure, the result is instant
Regards
7 Replies
- Greg_DecklerCommunity Champion
WSeirafi ISBLANK is notorious for bad performance. Try this:
Measure = IF ( SELECTEDVALUE ( Table[Column] ) = BLANK(), 1, 0 )or
Measure = IF ( SELECTEDVALUE ( Table[Column] ) <> BLANK(), 0, 1 )or
Measure = SWITCH( SELECTEDVALUE ( Table[Column] ), BLANK(), 1, 0 )- WSeirafiHelper I
I tried with both suggestions you gave
Measure =VAR CurrentVal = SELECTEDVALUE ( Table[Column] )RETURNSWITCH(CurrentVal,BLANK(),1,0)
Didn't change anything. There is no other way to do this ?I would have added a calculated column, but this is supposed to be reacting to a slicer- Greg_DecklerCommunity Champion
WSeirafi It's hard to say with the information provided. Would need additional context of the problem you are actually trying to solve. Is this something that could be done using the Filter pane?
- shafiz_pSuper User
Hi WSeirafi With "if" statements, you need to go through each item one by one. When you have a huge table , using "if" statements can be slow. It’s like checking each item individually. The default query timeout is 225 seconds. Please check its performance. Try with switch function, because it faster than "if".
- WSeirafiHelper I
I answered below, unluckily it was not effective