Forum Discussion
Anonymous
3 years agoNot applicable
Filter a column in Power Query by position?
Hi everyone,
I have a simple table like:
| Date | Day | Month | Year |
To filter Day, I could use = Table.SelectRows(Source, each ([Day] = "Monday")) for example. But I wonder if there is a way to filter the second column of the table instead of stating the column name?
I tried = Table.SelectRows(Source, each ([Table.ColumnNames(Source){2}] = "Monday")) but it didn't work.
Thank you.
Hi Anonymous ,
you are on the right track with that approach. Just change it to:
Table.SelectRows(Source, each (Record.Field(_, Table.ColumnNames(Source){2}) = "Monday"))