Forum Discussion

Jeanxyz's avatar
Jeanxyz
Power Participant
5 years ago
Solved

switch() syntax

Hi, I'm reading a DAX measure created by another developer and I get stuck with the following measure.   Reporting Amount Base_PL = SWITCH( [Selected Currency],1, [Group Currency Amount Base_PL (...
  • CNENFRNL's avatar
    5 years ago
    Reporting Amount Base_PL =
    SWITCH (
        [Selected Currency],
        1, [Group Currency Amount Base_PL (EUR)],
        2, [Company Currency Amount Base_PL],
        3, [Budget Currency Amount Base_PL (EUR)]
    )
  • parry2k's avatar
    5 years ago

    Jeanxyz based on your question this is where the condition is getting checked:

     

    Reporting Amount Base_PL =
    SWITCH (
        [Selected Currency],   --take the value of selected currency 
        1, [Group Currency Amount Base_PL (EUR)], --if it is 1 return this measure
        2, [Company Currency Amount Base_PL],    --if it is 2 return this measure
        3, [Budget Currency Amount Base_PL (EUR)]  -- if it is 3 return this measure
    )
    
    --if none of above condition met, means selected currency is not 1, 2, 3 it will return blank