Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Padideh
Regular 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? 😞
1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

very similar to the problem described here:
https://techcommunity.microsoft.com/t5/excel/power-query-select-first-column-for-function-table-sele...

Assuming 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)

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

3 REPLIES 3
Padideh
Regular Visitor

Yes! it works,Thank you for your solution Stachu. @Stachu 

Stachu
Community Champion
Community Champion

Glad to help 🙂 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Stachu
Community Champion
Community Champion

very similar to the problem described here:
https://techcommunity.microsoft.com/t5/excel/power-query-select-first-column-for-function-table-sele...

Assuming 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)

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors