Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Switch measure

Hello,

Im using following measure to calculate growth:

Total Tickets Growth W = ([Total Tickets] - [Total Tickets LW])/[Total Tickets LW]
Total Tickets Growth M = ([Total Tickets] - [Total Tickets LM])/[Total Tickets LM]
M - month, LM - last month
W - week, LW - last week
 
Now, Im using filter on Quarter, Month, Week & Day.
 
What I want to achieve is:
If I select "Week" in calnedar, then Total Tickets Growth W measure will be used
If I select "Month"  in calnedar, then Total Tickets Growth M measure will be used
 
I want to have only one column visible "Tickets Growth" (instead of two as I have now) in a Table and based on Week/Month selection will use correct measure.
 

 

  • Hi Anonymous 

    I am assuming those slicers are from a field parameter (please provide more context).

     

    A field parameter table includes a column named "Parameter Order." Use this column in your SWITCH formula to toggle between calculations based on the field selected from the slicer.

     

    Sample measure

    SWITCH (
        SELECTEDVALUE ( 'field parameter'[parameter order] ),
        1, [Month on Month Growth],
        2, [Week on Week Growth]
    )
    

     

     

1 Reply

  • Hi Anonymous 

    I am assuming those slicers are from a field parameter (please provide more context).

     

    A field parameter table includes a column named "Parameter Order." Use this column in your SWITCH formula to toggle between calculations based on the field selected from the slicer.

     

    Sample measure

    SWITCH (
        SELECTEDVALUE ( 'field parameter'[parameter order] ),
        1, [Month on Month Growth],
        2, [Week on Week Growth]
    )