Forum Discussion

MuppetyMe's avatar
MuppetyMe
Helper I
5 years ago
Solved

Help with Multiple Text Filters

Needing assistance with an expression to filter multiple text options. For example: 

 

Starts with Text A -or-

Starts with Text B -or-

Starts with Text C -or-

Starts with Text D

 

Is this even possible? Any suggestions? There are too many variables in the data source to use basic filtering as all of the above have additional words in the titles. 

11 Replies

  • MuppetyMe , you can create a new column like

     

    if( left([Column],1) in {"A","B","C", "D"} && not(left([Column],1) in {"E","F"} ) , true(), false())

    • MuppetyMe's avatar
      MuppetyMe
      Helper I

      amitchandak, thank you for the solution. Unfortunately the data admins have the source locked down in a manner that I'm unable to create columns (this is an SSAS cube). To the best of my knowledge I'm limited to measures and basic/advanced filters.

  • ERD's avatar
    ERD
    Community Champion

    Hello MuppetyMe ,

    If the text starts from A/B/C/D it already cannot start with E/F, so the second part of your expression is not clear to me.

    In case of measure:

    FirstLettersCheck = 
    IF(LEFT(SELECTEDVALUE(T[Column]),1) IN {"A","B","C", "D"},1,0)

     

    Did I answer your question? Mark my post as a solution! 

    • MuppetyMe's avatar
      MuppetyMe
      Helper I

      Hello ERD, thank you for the solution. Unfortunately this method does not work either... according to MS articles, "SELECTEDVALUE" does not work if the data source is a direct query. I'm frustrated because it feels like I'm super close to a solution with this suggestion, but it doesn't work. 

    • MuppetyMe's avatar
      MuppetyMe
      Helper I

      ALSO ERD, you are correct in your logic that if the text starts from A/B/C/D it already cannot start with E/F -- so thank you for that 🙂

  • Anonymous's avatar
    Anonymous
    Not applicable

    MuppetyMe 

     

    It would really help if you could put parentheses in the right places. Currently, one doesn't know if OR binds stronger than AND or the other way round.