Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kelbow
Employee
Employee

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?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

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"

 

 Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

13 REPLIES 13
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.

v-shex-msft
Community Support
Community Support

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"

 

 Capture.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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?

 

 

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...

Hi kelbow,

 

>>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.

 

Based on test, the ‘Advanced mode’ only support two option,  you can use the ‘base mode’ to select the specify records. But the page-level filter or report-level filter use ‘and mode’ to link, for example (filter1) and (filter2) not the ‘or mode’.

 

Since page-level filter or report-level filter not suitable for your requirement, you could use dax filter function or power query selectrows function to achieve your requirement.

 

Regards,

Xiaoxin Sheng

 

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

So feedback - the advanced mode should support more than two options. For me, and the number of values in my list, filtering through the base mode takes me more than 15 minutes to select my values since the only option is scrolling and not typing.

 

Is there a link to a topic or demo that shows how to use the dax filter function or power query select rows function?

Hi @kelbow,

 

>>Is there a link to a topic or demo that shows how to use the dax filter function or power query select rows function?

You can take a look at below links:

 

Filter Functions (DAX)

 

Filter a table (Power Query)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks. So...while I appreciate the pointer to those things, I guess that's not really my question. Where would I do that in PowerBI? The first topic gives me the syntax for filtering - which is nice...but literally - where would I do that in the PowerBI UI? The second topic, again, talks through how to do that with Power Query but, where do I find Power Query in PowerBI? Where would I do this in the UI on PBI desktop? Do I do this in the query editor? If so, is this a step I'm adding? I believe that's what I'm doing and I'm encountering this bug.

Hi @kelbow,

 

About dax formula, you can use like this:

 

Filtered Table= CALCULATETABLE(Table,FILTER(Table,Table[Column1]="A"||Table[Column1]="B"||Table[Column1]="C"||Table[Column2]="D"))

 

For Power query filter multiple columns, you can follow below steps:

 

1. Open query editor and click the column's drop down button to open the menu.

Capture.PNG

 

2. Choose one option which belowe the filter to open the filter rows panel, select the "advanced" mode.

Capture2.PNG

 

3. Add the filter conditions.

Capture3.PNG

 

4. Click ok to general the power query formula, you can check it by open the advanced editor.

Capture4.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

So the steps you show are precisely the ones I am following. When I do that, the only results that show up are items that meet only 2 of the 5 possible groups. I'm trying to explain that there is a BUG when I do this.

 

This is not a solution. It's broken.

Hi @kelbow,

 

Sorry for slowly resoponse, can you share me a sample to reproduce your issue? I will test on it.

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
ankitpatira
Community Champion
Community Champion

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

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. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.