Forum Discussion

alexvanlauwe's avatar
alexvanlauwe
New Member
5 years ago
Solved

Measure with multiple conditions

Hello to all,   So , I will try to explain my problem as precise as possible.   I would like to develop a measure with multiple conditions to determine the situation of the market :   I have fi...
  • mahoneypat's avatar
    5 years ago

    You are missing "(" after SWITCH.  Also, I would first store your two measures as variables and then use the variables in the SWITCH evaluations.  The way it is written will cause a lot of recalculation.  Partial example below (note that you should not include the table name when referencing measures so other knows it is a measure and not a column reference).

     

    Measure =
    VAR varpy3M = [TM3MR%VARPY]
    VAR varpy12M = [TM12MR%VARPY]
    RETURN
        SWITCH (
            TRUE (),
            varpy3M > 0
                && varpy12M < 0"RECOVERY",
            varpy3M >= 0.02
                && TM[TM12MR%VARPY] >= 0.02"EXPANSION",
            "Other"
        )

     

    Regards,

    Pat