Forum Discussion

MichaelHalling's avatar
MichaelHalling
Frequent Visitor
5 years ago
Solved

Using nested list to filter nested table

In my main table [FilterListZC] I have a column [FilterZC] which contains nested lists, and a column [Selected] of nested tables. Each nested table in [Selected] contains a column [TenorCode] I would like to filter with the values in the corresponding list in [FilterZC].

I have tried various solutions but none work. Here is an example of one that does not work:
= Table.AddColumn(FilterListZC, "FilteredZC", each Table.SelectRows([Selected], each List.Contains( (r)=> [FilterZC], [TenorCode])))


 

Is this possible? What do I need to change? 

Thanks a million for any help!

  • Hi MichaelHalling ,

    you can try the following, otherwise please provide sample data:

     

    Table.AddColumn(FilterListZC, "FilteredZC", each Table.SelectRows([Selected], (r) => List.Contains( FilterZC], r[TenorCode])))

     

4 Replies

    • ImkeF's avatar
      ImkeF
      Community Champion

      Hi MichaelHalling ,

      you can try the following, otherwise please provide sample data:

       

      Table.AddColumn(FilterListZC, "FilteredZC", each Table.SelectRows([Selected], (r) => List.Contains( FilterZC], r[TenorCode])))

       

      • MichaelHalling's avatar
        MichaelHalling
        Frequent Visitor

        ImkeFYou are amazing! That worked! Don't really know what r[TenorCode] does but it solved my problem. Also gotten a few helpful tips from your blog before this so a big THANK YOU for all your work. MFelix Thanks for caring 🙂

         

        PS. You missed a '[ ' in [FilterZC] so for anyone reading this, this is the exact code that solved my problem. 

        Table.AddColumn(FilterListZC, "FilteredZC", each Table.SelectRows([Selected], (r) => List.Contains( [FilterZC], r[TenorCode])))