Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Multiple filter using switch true in allselected

I create new table where I defined names my filter (there is no relationship between dataset)

Then I create measere

 
TRN =
SWITCH(
TRUE(),
"Online" IN ALLSELECTED(Channel_name[Channel]),Indicators[t_online],
"Dealer Shops" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_dealer_shops],
"Own Shops" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_own_shops],
"Biznis" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_bz],
"TAM" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_tam],
"0")
 

Measure works but once I chosee multiple value from filter it doest work. Can you please help how to change my code for multiple options?

 

 

 

 

 

 

 

 

  • Anonymous , I think you need to provide more information. what I can think now is

     

    if("Online" IN ALLSELECTED(Channel_name[Channel]),Indicators[t_online],0) +
    if("Dealer Shops" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_dealer_shops],0) +
    if("Own Shops" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_own_shops],0) +
    if("Biznis" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_bz],0) +
    if("TAM" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_tam],0)

3 Replies

  • Anonymous , I check this one and it working.

     

    Measure = Switch(true(), "ABC" in ALLSELECTED('Table'[Column1]) , "A",
    "DEF" in ALLSELECTED('Table'[Column1]) , "B",
    "C")

     

    but in case you expect two values, then you need a different way

     

    Multiple if and append by &

    • Anonymous's avatar
      Anonymous
      Not applicable

      For example 

      I choose
      "Online" and get TRN 127

      "Dealer Shops" and get TRN 702

       

      I need to have for example:

      "Online" & "Dealer Shops" and get 829

       

      Do you have idea how to do it?

       

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , I think you need to provide more information. what I can think now is

         

        if("Online" IN ALLSELECTED(Channel_name[Channel]),Indicators[t_online],0) +
        if("Dealer Shops" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_dealer_shops],0) +
        if("Own Shops" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_own_shops],0) +
        if("Biznis" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_bz],0) +
        if("TAM" IN ALLSELECTED(Channel_name[Channel]), Indicators[t_tam],0)