Forum

Filter query column...
 
Notifications
Clear all

Filter query column based on a separate table/range

3 Posts
2 Users
0 Reactions
123 Views
(@ajr-pem)
Posts: 2
New Member
Topic starter
 

Hello there,

I have a query that presents all invoices in the current year to date. I would like to filter this data by customer, using a separate list of our top 20 customers by spend.

I have tried using the following, where tTopCustomers is my separate tabulated list of top 20 customers and [CUSTOMER] is the column in the invoice data that I wish to filter:

= Table.SelectRows(#"Reordered Columns", each Table.Contains(tTopCustomers, [CUSTOMER]))

But this only results in an expression error along the lines of

"We cannot convert the value "*CUSTOMERNAME*" to type Record.

Details:

Value=*CUSTOMERNAME*

Type=Type"

 

First of all, am I using a valid function to achieve the desired filter and if so, how do I correct the error?

Also, I had originally tried to use List.Contains, however I'm unable to find a way to convert the table query to a list - is this possible in excel?

Thanks for your help 🙂 

 
Posted : 26/04/2019 8:47 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Alex,

Welcome to our forum.

You can do this with a merge. See file attached. I've done a 'merge as new', but you could replace the tInvoices with a merge on that table.

Mynda

 
Posted : 26/04/2019 7:48 pm
(@ajr-pem)
Posts: 2
New Member
Topic starter
 

Thank you, Mynda - often the simple answer is staring us right in the face!

 
Posted : 27/04/2019 3:55 am
Share: