Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jacu
Frequent 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 based on the filtered option. It slows down to 30 sec.. The variables add around 5 sec (even when they only find out the filtered item and if it is HASONFILTER).

 

My goal is to use one measure when "Year-1" option is filtered and another measure when "Budget" is filtered etc..

I cant understand how it can slow down so significantly. Thank you for any help!

 

Goal (Month): =

VAR L1 = [MI] RETURN
VAR ITM = LEFT([ITM];8) RETURN
VAR SEL_VAL = [SI] RETURN


IF(
L1=FALSE();
 
SWITCH(ITM;
"Budget";[Net Contribution Budget (month)];
"Year-1";[Net Contribution PY (month)];
"Year-2";[Net Contribution Year-2 (month)];
"Forecast";[Net Contribution Forecast (month)])
;
SWITCH(ITM;
"Budget";[Budget (Month):];
"Year-1";[Year-1 (Month):];
"Year-2";[Year-2 (Month):];
"Forecast";[Forecast (Month):])
)

 

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @jacu 

 

If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly.thanks!

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @v-diye-msft ,

 

no, unfortunately it did not help and also I did not fix it yet.  I hoped it could be some easy fix. I will spend some time on it later as need to finish something else first.

 

 

MFelix
Super User
Super 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.

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.