Forum Discussion
Anonymous
7 years agoNot applicable
IF Statement taking too long to execute
Hi, I have created a multiple IF statement but the statement is taking too long to execute, is there a way around this? My measure: Trend = IF([Count Negative Results] = 6, "Losing", IF([C...
- 7 years ago
Have you tried using 'SWITCH'?
Trend = SWITCH( TRUE() ,
[count negative results] = 6 , "Losing" ,
[count negative results] in {3,4,5} && [Average Moving and CY TTM] <= -.6 , "Losing" ,etc....
This has sped up my nested IF statements in the past.
- 7 years ago
Have you tried making a call the measures and storing as variables outside of the IF/SWITCH ?
Trend = var __CountNeg = [Count Negative Results] var __AvgMov = [Average Moving and CY TTM] RETURN SWITCH(TRUE(), __CountNeg = 6, "Losing", __CountNeg in {3,4,5} && __AvgMov <= -.6 ,"Losing", ...
dedelman_clng
Community Champion
7 years agoHave you tried making a call the measures and storing as variables outside of the IF/SWITCH ?
Trend =
var __CountNeg = [Count Negative Results]
var __AvgMov = [Average Moving and CY TTM]
RETURN
SWITCH(TRUE(),
__CountNeg = 6, "Losing",
__CountNeg in {3,4,5} && __AvgMov <= -.6 ,"Losing",
...
Anonymous
7 years agoNot applicable
Worked like a charm! Thank you all!
- TomMartens7 years ago
Super User
Hey Anonymous,
please mark the most helpful post as an answer, as it also helps others in this forum.
Regards,
Tom