Forum Discussion
Petri
3 years agoFrequent Visitor
Using a parameter to refer to a column in Power Query
I try to use a parameter to select a (date) column and then filter the latest value in that column. The name of the column varies in source files but is always the first column, so I tried: Firs...
- 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
ppm1
3 years agoSolution Sage
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