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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Richard_Halsall
Helper IV
Helper IV

Expand table using column name and not text value

Hi

 

I have this syntax which works great and allows me to expand all columns from a merge table named 'TechRates' that start with "UK"

 

#"Merged Queries" = Table.NestedJoin(#"Filtered Rows2", {"Technician Type"}, TechRates, {"US- TechType"}, "Technicians", JoinKind.LeftOuter),
DocColumnList = List.Buffer(List.Select(Table.ColumnNames(TechRates), each Text.StartsWith(_ , "UK") )),
#"Expanded Technicians" = Table.ExpandTableColumn(#"Merged Queries", "Technicians",DocColumnList),

 

I would now like to make this dynamic using a text field in the base table named ABC Division as shown 

 

#"Merged Queries" = Table.NestedJoin(#"Filtered Rows2", {"Technician Type"}, TechRates, {"US- TechType"}, "Technicians", JoinKind.LeftOuter),
DocColumnList = List.Buffer(List.Select(Table.ColumnNames(TechRates), each Text.StartsWith(_ , [ABC Division]) )),
#"Expanded Technicians" = Table.ExpandTableColumn(#"Merged Queries", "Technicians",DocColumnList),

 

but I get this error
Expression.Error: We cannot apply field access to the type Text.
Details:
Value=US- TechType
Key=ABC Division

What I cannot figure out is the syntax needed to reference the column name ABC Division as a text value so it can be used.

Any help would be appreciated. Thanks

1 ACCEPTED SOLUTION
m_dekorte
Super User
Super User

Hi @Richard_Halsall,

 

Do all rows in the ABC Division column of the base table contain the same text?

If so, try this to get the initial value: BaseTableName{0}[ABC Division]  this syntax can also be generated by the UI when drilling down into a cell's value.

 

DocColumnList = List.Buffer(List.Select(Table.ColumnNames(TechRates), each Text.StartsWith(_ , BaseTableName{0}[ABC Division]) ))

 

 I hope this is helpful

View solution in original post

2 REPLIES 2
m_dekorte
Super User
Super User

Hi @Richard_Halsall,

 

Do all rows in the ABC Division column of the base table contain the same text?

If so, try this to get the initial value: BaseTableName{0}[ABC Division]  this syntax can also be generated by the UI when drilling down into a cell's value.

 

DocColumnList = List.Buffer(List.Select(Table.ColumnNames(TechRates), each Text.StartsWith(_ , BaseTableName{0}[ABC Division]) ))

 

 I hope this is helpful

Many thanks that worked perfectly

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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