Forum Discussion
Using a parameter to refer to a column in Power Query
- 3 years ago
You can use this syntax in your Filtered Rows step.
= let firstcolumn = Table.ColumnNames(Source){0},
latestdate = List.Max(Table.Column(Source, firstcolumn))
in
Table.SelectRows(Source, each Record.Field(_, firstcolumn) = latestdate)Replace Source with your previous step name throughout.
Pat
guess
NewStep=Table.LastN(Table.Sort(OurTable,Table.ColumnNames(OurTable){0}))
This seems to be on the right track but I got error: "1 arguments were passed to a function which expects 2". If I modify the line by adding a number in the end:
NewStep=Table.LastN(Table.Sort(OurTable,Table.ColumnNames(OurTable){0}),3)
it gives me three rows each of which has the latest (30/09/2022) date. But if I try to replace '3' with something similar to the Last.Max in my original post, I get the same issue. I do not know how may rows there are for each date.