Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Switch Selected Value for no selected value

So I have a working switch statement for a selected value, with two options, but I was wondering if I could get a third switch statement working for if neither option is selected.

 

the Slicer has option A and B, so I want my formula to work for A and B and neither option pressed. 

 

Currently I have: 

 

SWITCH(SELECTEDVALUE(Choice),"A",SUM(X),"B",sum(Y),"",SUM(Z))
 
so I have tried with "" but when I press no options on the slicer, nothing appears in the graph, can anyone please advise?
  • Hi Anonymous  could you please try this

     

    SWITCH(
    TRUE(),
    SELECTEDVALUE(Choice) = "A", SUM(X),
    SELECTEDVALUE(Choice) = "B", SUM(Y),
    TRUE(), SUM(Z)
    )

3 Replies

  • ravsha85's avatar
    ravsha85
    Frequent Visitor

    Hi Anonymous  could you please try this

     

    SWITCH(
    TRUE(),
    SELECTEDVALUE(Choice) = "A", SUM(X),
    SELECTEDVALUE(Choice) = "B", SUM(Y),
    TRUE(), SUM(Z)
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      That Worked! Thanks So Much. 

    • juleshorton's avatar
      juleshorton
      Advocate III

      This syntax works better than most I've tried, but mine doesn't switch to the last option when nothing is selected?