Power Query - Filter List Based On Group

LarsAustin

New Member
Joined
Feb 27, 2016
Messages
16
Hi All,

I need help.

I have the following data in Power Query:
Invoice No.Item No.Group
IN083860233853Non-Commodity
IN083860211464Non-Commodity
IN083860737301Non-Commodity
IN083860711472Non-Commodity
IN083860712903Non-Commodity
IN083860811810Commodity
IN083860811439Non-Commodity
IN083860813132Commodity
IN083860911430Non-Commodity
IN083860911736Non-Commodity
IN083860911464Non-Commodity
IN083860911472Non-Commodity
IN083860951938Commodity
IN083861611481Non-Commodity
IN083861611497Non-Commodity
IN083861611739Non-Commodity
IN083861651637Commodity
IN083861751995Commodity
IN083861711481Non-Commodity
IN083861711738Non-Commodity
IN083862553071Commodity
IN083862551355Commodity
IN083862551637Commodity
IN0838625112433Non-Commodity
IN083862512298Non-Commodity
IN083862951460Non-Commodity
IN083862912639Non-Commodity
IN083863551938Non-Commodity
IN083863552972Non-Commodity
IN0838635720644Non-Commodity

What I am trying to do is filter only the Invoice No. (first column) in which one or more items has Commodity as Group - but I need to include the Item No. in the output even if the corresponding group is non-commodity. Basically, I want to remove the invoice numbers in which the items under it are non-commodity.

The desired output will be like the one below:

Invoice No.Item No.Group
IN083860811810Commodity
IN083860811439Non-Commodity
IN083860813132Commodity
IN083860911430Non-Commodity
IN083860911736Non-Commodity
IN083860911464Non-Commodity
IN083860911472Non-Commodity
IN083860951938Commodity
IN083861611481Non-Commodity
IN083861611497Non-Commodity
IN083861611739Non-Commodity
IN083861651637Commodity
IN083861751995Commodity
IN083861711481Non-Commodity
IN083861711738Non-Commodity
IN083862553071Commodity
IN083862551355Commodity
IN083862551637Commodity
IN0838625112433Non-Commodity
IN083862512298Non-Commodity

Something in my head is telling me that this is a simple fix but I just cannot figure it out. Your help will be much appreciated.

Thank you

Lars
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try to load the data into two queries using the same table.

1.)Make a Query which is group by "Advanced" columns [Invoice No.] and [Group] > then filter column [Group] "Commodity".
This in turn should return you a list of Invoices which has commodity in [Group] column.

2.)Make a Query which loads your original table.

3.)Merge Query1 and Query2 using left outer. Then expand the table which is returned during the merge. Tadaa!

This should return the desired output.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top