Forum Discussion

smpa01's avatar
smpa01
Community Champion
1 year ago
Solved

Parametrize columns

I am having issue to pass on columns as parameter for a function callback   Non function version let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJSit...
  • AlexisOlson's avatar
    1 year ago

    I think this is what you are intending to do.

    let
        Source = Table.FromRows({{1,2},{2,3},{3,4}}, type table[colA = Int64.Type, colB = Int64.Type]),
        fx = (tbl as table, filterCol as text) as table =>
            Table.SelectRows(tbl, (_) => Number.IsEven(Record.Field(_, filterCol))),
        filter = fx(Source, "colB")
    in
        filter