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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Swap text based on Delimiter

Hi All,
I was wondering if there was a simple way to swap text values in a column based on a comma delimiter as I would like the split the column to a 'City' column?

Example:

My column named 'Country' has text values of
Sydney, Australia

I want to change these values to:

Australia, Sydney

Any assistance greatly appreciated!


 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

I think I found another way around it using Extract text

= Table.TransformColumns(#"Added Custom", {{"Country", each Text.BeforeDelimiter(_, ","), type text}})

View solution in original post

collinsg
Super User
Super User

Good day fred65,

I'm glad you found a solution for yourself. Here is an alternative.

  1. Split the string to a list.
  2. Reverse the list.
  3. Combline the list to a string.

The code is as follows. Replace "Source" with the name of your previous step.

= Table.TransformColumns(
Source,
{
{"Country", each Text.Combine(List.Reverse(Text.Split(_, ", ")), ", ")}
}
)

 Hope this helps.

View solution in original post

2 REPLIES 2
collinsg
Super User
Super User

Good day fred65,

I'm glad you found a solution for yourself. Here is an alternative.

  1. Split the string to a list.
  2. Reverse the list.
  3. Combline the list to a string.

The code is as follows. Replace "Source" with the name of your previous step.

= Table.TransformColumns(
Source,
{
{"Country", each Text.Combine(List.Reverse(Text.Split(_, ", ")), ", ")}
}
)

 Hope this helps.

Anonymous
Not applicable

I think I found another way around it using Extract text

= Table.TransformColumns(#"Added Custom", {{"Country", each Text.BeforeDelimiter(_, ","), type text}})

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.