Forum Discussion

Mederic's avatar
Mederic
Icon for Post Patron rankPost Patron
2 years ago
Solved

Multiple List of criteria

Hello,


I have a table with more than ten thousand rows,
And 2 lists of criteria, each with up to fifty cells
I thought of using the code below.
Is there a better, more elegant way?

Thanks in advance

 

Best regards

 

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Supplier", Int64.Type}, {"Product", type text}, {"Réf", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each List.Contains(List.Buffer(Criteria1),[Supplier])=true and List.Contains(List.Buffer(Criteria2),[Réf])=true)
in
    #"Filtered Rows"

 

SupplierProductRéf

401001A2
401001A3
401001A1
401002B4
401002B5
401001B3
401001C1
401004C8
401004D2
401004D1
401003A2
401004F2

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Looks good--but you don't need the "=true" in either place.

     

    --Nate

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Looks good--but you don't need the "=true" in either place.

     

    --Nate

  • Hello Anonymous ,

    Thank you for your reply and your comment
    I'm going to use this code and remove the true operator

    Best regards