Forum Discussion
Padideh
3 years agoRegular Visitor
Filter a column dynamicly (its name is changable)
Hello everyone. I want to filter a column in a table "My Data" ( in excel powerquery) but it changes, for example one day its "Name" column and another day I need to filter "Age" Column. I created a table from My column name as "MyTBL" that I want to filter them, and import it as a List. imagin always I want filter a column that its name is equal to first record of list ( MyTBL{0} ) how can I put this MyTBL{0} in my filter function? I tried this but it didnt work = Table.SelectRows(#"My Data", each ([MyTBL{0}] = XXXX )) Can you Help Me pls? 😞
very similar to the problem described here:
https://techcommunity.microsoft.com/t5/excel/power-query-select-first-column-for-function-table-selectrows/m-p/2630841Assuming MyTBL{0} returns the string with the column name, not an actual record type, something like this should work:
Table.SelectRows(#"Changed Type", each (Record.Field(_,MyTBL{0}) <> XXXX))(where #"Changed Type" is the name of the previous step)
3 Replies
- StachuCommunity Champion
Glad to help 🙂
- StachuCommunity Champion
very similar to the problem described here:
https://techcommunity.microsoft.com/t5/excel/power-query-select-first-column-for-function-table-selectrows/m-p/2630841Assuming MyTBL{0} returns the string with the column name, not an actual record type, something like this should work:
Table.SelectRows(#"Changed Type", each (Record.Field(_,MyTBL{0}) <> XXXX))(where #"Changed Type" is the name of the previous step)