Forum Discussion

scottjl's avatar
scottjl
Frequent Visitor
5 years ago
Solved

Filter multiple values from different columns

Hi,

 

I'm trying to filter my results where the value of column A is "yes" or the value of column B is "yes". Can someone help with the query?

 

Edit: It's a view back to a database and won't let me create a calculated column.  Is there another way to do this?

Thanks

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  scottjl ,

    This is the data I created:

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    IF(
        MAX('Table'[priority])="Yes"||MAX('Table'[resources])="Yes",1,0)

    Result:

    Now it shows that all data exist. Measure marks the unqualified data as 0 and the qualified data as 1

    2. Put measure into filter, set is = 1, and apply filter

    3. Result:

    Display the data that meet the requirements:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  scottjl ,

    This is the data I created:

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    IF(
        MAX('Table'[priority])="Yes"||MAX('Table'[resources])="Yes",1,0)

    Result:

    Now it shows that all data exist. Measure marks the unqualified data as 0 and the qualified data as 1

    2. Put measure into filter, set is = 1, and apply filter

    3. Result:

    Display the data that meet the requirements:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Add a custom column with this expression and then filter the new column on "Y"

     

    if [Column A] = "yes" or [Column B] = "yes" then "Y" else "N"

     

    Pat

     

    • scottjl's avatar
      scottjl
      Frequent Visitor

      Thanks Pat. It's a live database view so it won't let me add a new column. Can i do it with a measure?

  • Anonymous's avatar
    Anonymous
    Not applicable

    This is not possible from the filter pane. You might want to create a calculated column as OR([Column A]="yes",[Column B]="yes") and then filter on the calculated column

  • scottjl 

    You can apply a filter as follows

    FILTER ( 
       TABLE,
       TABLE[COLUMN A] = "YES" ||  TABLE[COLUMN B] = "YES"
    )
    • scottjl's avatar
      scottjl
      Frequent Visitor

      Sorry, newbie question, where do I go in desktop to apply that filter?

      • Fowmy's avatar
        Fowmy
        Super User

        scottjl 

        Can you explain what you are trying to acheive? Do you need a table as output or need to apply filtering inside a measure? Better provide some sample data and the expected results.