Forum Discussion
jacu
6 years agoFrequent Visitor
Poor performance after using SWITCH + NESTED MEASURES
Hi Guys, i'm having difficulties with the performance. When I use measure "Year-1 (Month)" alone it loads in 5 sec. Once I use the same but as part of another measure which selects the measure...
MFelix
6 years agoSuper User
Hi jacu ,
First of all why are you using the RETURN after every variable?
You can use variable within variable without the return.
Looking at you code you are picking up the text and then selecting the 8 first carachters of the text within a variable (assuming that because of the names withing brackets without table reference).
Have you also tried instead of using an if statment create the swithc with the validation of both the variables something similar to this:
Goal (Month) =
VAR L1 = [MI]
VAR ITM =
LEFT ( [ITM]; 8 )
VAR SEL_VAL = [SI]
RETURN
SWITCH (
TRUE ();
L1 = FALSE ()
&& ITM = "Budget"; [Net Contribution Budget (month)];
L1 = FALSE ()
&& ITM = "Year-1"; [Net Contribution PY (month)];
L1 = FALSE ()
&& ITM = "Year-2"; [Net Contribution Year-2 (month)];
L1 = FALSE ()
&& ITM = "Forecast"; [Net Contribution Forecast (month)];
L1 = TRUE ()
&& ITM = "Budget"; [Budget (Month):];
L1 = TRUE ()
&& ITM = "Year-1"; [Year-1 (Month):];
L1 = TRUE ()
&& ITM = "Year-2"; [Year-2 (Month):];
L1 = TRUE ()
&& ITM = "Forecast"; [Forecast (Month):]
)
Not sure if this can help without any example. If this does not work can you share a sample file.