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", ...
Anonymous
7 years agoNot applicable
Hey,
Thanks for the above inputs, I have different measures and i am counting the frequency of negative values of those measure. I dont find any other way to add these measures, please help!
Count Negative Results = IF([TTM Var 1] < 0,1,0) + IF([TTM Var 2] < 0,1,0) + IF([TTM Var 3] < 0,1,0) + IF([TTM Var 4] < 0,1,0) + IF([TTM Var 5] < 0,1,0) + IF([TTM Var 6] < 0,1,0)
Using If statement is the problem here for large computational time, please guide me if there is a way around.
Thanks!
mwarren
7 years agoFrequent Visitor
Instead of a measure try doing that for a calculated column. This way it will do the calculation when it brings in the data rather than at the time you are trying to run the query.