Forum Discussion

dslForPBI's avatar
dslForPBI
Helper I
8 years ago
Solved

Using a list parameter as a table filter in M language

I have an M language query in which I would like to use list values from a parameter list. Each attempt causes only the default or current item to be read. Is it possible to pull all the items from t...
  • nickchobotar's avatar
    nickchobotar
    8 years ago

    dslForPBI

     

    You nee to use List.ContainsAny() function.   *** MAKE SURE you wrap your field name in curly brackets.

    = Table.SelectRows(
    PreviousStep,
    each List.ContainsAny( { 543,95,96,1359,1360,1104 } , { [CodeValueField] }
    ))

     

    Results returned :

     

    543
    95
    96
    1359
    1360
    1104

     

     

    where CodeValueField field contains all the values below:

     

    CodeValueField

     

    543
    95
    96
    1359
    1360
    1104
    1170
    1172
    93
    1248
    454
    1361
    92
    97
    -4
    -3
    -5
    -7
    -8
    -2