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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Parsing column name to SelectRows

Hello

 

I want to parse a dynamic Column Name to a Table.SelectRows so that I can switch which column to apply a row filter.

 

Is that possible? Tried several things but had to resolve to unpivoting to filter.

 

Thanks!

4 REPLIES 4
nwong-nbbb
New Member

Hi, @Anonymous ,

I just encountered the same question working with Power Query for excel and found your post. I expect the object models to be very similar, but would recommend testing for each environment. While I am by no stretch an export, I agree that "It's not supported" is an inadequate answer.

The syntax for the method in Excel has the following structure, with an example of a condition of Text.Contains satisfying the request:

Table.SelectRows(TableRef as table, each Text.Contains([FixedFieldName], ConditionValue as text)

There are two things worth noting here. First, the "each" operator is generating an iterative reference for every row in the table. Second, the [FixedFieldName] appears at first glance to refer to the field value in the table, but is instead being applied to the object returned by the "each" iterator. With this in mind, the dynamic Column Name should be accessible through the correct object interface. Again, this may vary for PowerBI, but is hopefully similar.

The most appropriate object available in excel for an iterated row is the Record object. Updating our previous example provides the following:

Table.SelectRow(TableRef as table, each Text.Contains(Record.Field((_), ColumnName as text), ConditionValue as text)

In PowerQuery, this can be packaged as a custom function, and reused with a call similar to TableContains(TableRef, ColumnName, ConditionValue).

I hope you and others find this helpful in fighting with the object model.

Best regards.


Anonymous
Not applicable

Thanks but that is not adequate. I need to have a text parameter that will be fed into Table.SelectRows, is that possible please?

Hi, @Anonymous 

Are you referring to parameterizing the specified columns and filter criteria to filter data dynamically?
Sorry, I'm afraid it's not currently supported.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Anonymous ,Table.ColumnNames can give you list of column names, if that can help in some way

https://learn.microsoft.com/en-us/powerquery-m/table-columnnames

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors