Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

row filter with multiple clauses

Hi,

I'm building a dashboard with a data set where I want to filter the rows down by multiple OR clauses. It appears to do so, however, when I apply the filter, it only retains the last two clauses. Is this a known restriction?

 

Here's what I get;

= Table.SelectRows(#"Renamed Columns", each [OwnerLogin] = "officedev" or [OwnerLogin] = "onenotedev" or [OwnerLogin] = "onedrive" or [OwnerLogin] = "microsoftgraph" or [FullRepoName] = "Microsoft/Resource-Static-Analysis")

 

But generally speakig, the result only gives me rows filtered to the last two:

[OwnerLogin] = "microsoftgraph" or [FullRepoName] = "Microsoft/Resource-Static-Analysis"

 

Suggestions?

  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi kelbow,

     

    I agree with ankitpatira’s point of view, it seems more suitable than use query edit.

     

    Based on test, I can’t reproduce your issue, it works well, can you provide more info about this operation? Before you add filters, please check if there are records meet [OwnerLogin] = "officedev" or [OwnerLogin] = "onenotedev" or [OwnerLogin] = "onedrive".

     

    Test sample

    Power query formula:

    let
    
        Source = OData.Feed("services.odata.org/V4/Northwind/Northwind.svc"),
    
        Employees_table = Source{[Name="Employees",Signature="table"]}[Data],
    
        #"Filtered Rows" = Table.SelectRows(Employees_table, 
    
        each [City] = "London" 
    
        or [City] = "Redmond" 
    
        or [City] = "Tacoma" 
    
        or [City] = "Seattle" 
    
        or [Region] = "WA")
    
    in
    
    #"Filtered Rows"

     

     

     

    Regards,

    Xiaoxin Sheng

13 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi kelbow,

     

    I agree with ankitpatira’s point of view, it seems more suitable than use query edit.

     

    Based on test, I can’t reproduce your issue, it works well, can you provide more info about this operation? Before you add filters, please check if there are records meet [OwnerLogin] = "officedev" or [OwnerLogin] = "onenotedev" or [OwnerLogin] = "onedrive".

     

    Test sample

    Power query formula:

    let
    
        Source = OData.Feed("services.odata.org/V4/Northwind/Northwind.svc"),
    
        Employees_table = Source{[Name="Employees",Signature="table"]}[Data],
    
        #"Filtered Rows" = Table.SelectRows(Employees_table, 
    
        each [City] = "London" 
    
        or [City] = "Redmond" 
    
        or [City] = "Tacoma" 
    
        or [City] = "Seattle" 
    
        or [Region] = "WA")
    
    in
    
    #"Filtered Rows"

     

     

     

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      I can confirm that there are records that meet those criteria. Why is a report or page level filter more appropos in this case? I'd like to understand the rationale so I can make the right choice in the future. What are the benfits of choosing one approach over another?

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        OK. So the other problem I have with your suggested solution is that I have a complex filter...

         

        I want rows where

        ownerlogin = X

        OR

        ownerlogin = Y

        OR

        ownerlogin = Z

        OR

        repoName = ZZ

         

        I can't determine how to do that as part of a report or page level filter.  When I try to use the report or page-level filter, using the Advanced tab, I can only choose two criteria and I need to choose four criteria. Also, I can do the first filters but not the last one because it's a different dimension...

  • ankitpatira's avatar
    ankitpatira
    Community Champion

    Anonymous It apperas you're filtering via query editor. Instead I would suggest you import all then filter via page-level or report-level filter.

    • Diego-mx's avatar
      Diego-mx
      Advocate I

      Because of how my data is loaded, I don't agree with this. 
      The table from the query editor is large enough to take several seconds.   So every operation on it takes longer, and thus it is better for me to filter it the earliest possible to reduce the wait time. 

      Just commenting to consider such situation. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    You can create a custom column and right  your logic with if condition for instance if x=y or x=a or x=w then yes else no and filter the column itself with yes condtion.I think this will solve your issue.