cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KellyLen Regular Visitor
Regular Visitor

Filtering rows with multiple conditions

Hello,

 

I have a problem with filtering certain rows. 

I would like to filter out from all of my data rows, which firstly in column "Category" are "Candies" and column "Accounts" are anything else but "123" and "345". So I would like to exclude from my data all the other Candies accounts beside "123" and 345". This Candies filtering is important as I have like hundred other category as well. 

 

Best regards,

Kelly  

9 REPLIES 9
Super User
Super User

Re: Filtering rows with multiple conditions

Hi,

 

Have you tried applying these conditions in the Query Editor?  If yes, then what problem do you face?

KellyLen Regular Visitor
Regular Visitor

Re: Filtering rows with multiple conditions

Hi! 

 

Yes, I tried to filter it in query editor, but then it filtered all the "Candies" out and did not left any candies to the data. And advcanced filtering does not allow me to create a condition "anything else but "123""? 

Super User
Super User

Re: Filtering rows with multiple conditions

Hi,

 

Share some data to work with and also show your expected result.

KellyLen Regular Visitor
Regular Visitor

Re: Filtering rows with multiple conditions

I created an example to excel:

image.png

And result should be like this:

image.png

All the other candies with accounts, which are not 123 and 345, are gone. 

 

Does this help? 

Super User
Super User

Re: Filtering rows with multiple conditions

Hi,

 

Why are 879 and 478 appearing there?  I just do not understand your filtering conditions.

KellyLen Regular Visitor
Regular Visitor

Re: Filtering rows with multiple conditions

Hi,

 

It is hard to make an example table to you, I cannot present the real data. But these are just for example that you could understand that I have not got only candies with accounts, but other things as pies with the same accounts as well. So actually I need that all the other data would remain the same and Candies would appear only with accounts 123 and 345. Does it make more sense? Smiley Happy 

Highlighted
KellyLen Regular Visitor
Regular Visitor

Re: Filtering rows with multiple conditions

Is there anyone, who could help? 

Super User
Super User

Re: Filtering rows with multiple conditions

Hi @KellyLen,

 

In the power query add this column to your data:

 

if [Category] <> "Candies" 

  then "keep" 

else 
        if  ([Category] = "Candies" and [Accounts] = 123 ) 
        or  ([Category] = "Candies" and [Accounts] = 658 )   
       then "keep" 
else ""

 

Then just do a filter on keep and delete the column you just created:

 

TTT.png

 

Regards,

MFelix



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

Proud to be a Datanaut!




KellyLen Regular Visitor
Regular Visitor

Re: Filtering rows with multiple conditions

Super! It worked, if I added "" to the accounts as well. Smiley Happy 

 

Thank you very much! 

 

Best regards,

Kelly