Forum Discussion

JohnnyDax's avatar
JohnnyDax
Helper I
3 years ago
Solved

DAX Performance with multiple switch

Hi everyone,   I'm currently experiencing issue with a dataset : i can't load some visual, it's telling me that our capacity is at max memory (6144Mo) and what it's strange it's that until now it a...
  • tamerj1's avatar
    3 years ago

    Hi JohnnyDax 
    Please try

    Revenue =
    VAR A =
        SELECTEDVALUE ( dim_taxe[CA] )
    VAR B = [Ticket - Montant HT Brut]
    VAR C = [Ticket - Montant HT Net]
    VAR D = [Ticket - Montant gratuit HT]
    VAR E = [Ticket - Montant TTC Brut]
    VAR F = [Ticket - Montant TTC Net]
    VAR G = [Ticket - Montant gratuit TTC]
    VAR X =
        SWITCH ( A, "CA Brut", B, "CA Net", C, C - D )
    VAR Y =
        SWITCH ( A, "CA Brut", E, "CA Net", F, F - G )
    RETURN
        SWITCH ( A, "HT", X, Y )