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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rpiboy_1
Helper V
Helper V

Combine Text from one column in Table.TransformColumns

Let us say we have a table like such:

Group CodeSub group Code
10null
1010
1020
20null
2010
2020
2030

 

In the table I want to transform the column [Sub group Code] in place, so that I get the following result:

Group CodeSub group Code
10null
1010_10
1010_20
20null
2020_10
2020_20
2020_30

 

I'm trying to use:

 

 

 

 

= Table.TransformColumns(#"PreviousStep", {{"Sub group Code", each Record.Field(_, "Group Code") & "_" & Text.From(_, "en-US"), type text}})

 

 

 

 

But it throws an error "We cannot apply field access to the type Text". I always seem to struggle with being in the right context for '_' so I'm quite certain my issue is around getting the value from the column 'Group Code'. Suggestions appreciated, explanation always helpful!

I realize I'll need some conditional logic for retaining the null state, but I don't think that is where my issues is?

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

3 REPLIES 3
ImkeF
Community Champion
Community Champion

Hi @rpiboy_1 ,
you have to use a different function for it:
Table.TransformColumns - alternative in PowerBI and PowerQuery in Excel (thebiccountant.com)

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

@ImkeF that worked quite nicely! Thank you. Curious to understand more about your performance comment? Is the solution less performant because its using a table function, that has to iterate over the whole table, versus adding and removing columns, which is less intensive?

@ImkeF thanks for the link/tip. Looks promising! I'll give it a go tomorrow and confirm.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.