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
Anonymous
Not applicable

How to split a column every two delimiters

Hello, I'm new to Power Bi, and I'm trying to split a column every two commas, but I cannot find the correct argument to do it.

This is how my column looks (this is how the data is being sent to me).

LastName,Name,LastName,Name,LastName,Name

Sometimes is only one name, but it can contain up to 5 names, and I need each one in a separate column.

I hope someone can help me thank you!!!

 

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

As metioned by @Greg_Deckler

If the names are not  many, you can split them all, and then merge   name and Last name  columns one by one.

 

2012.png

2014.png

 

2015.png

 

You also can refer  to this artice, if there are too many names.

https://community.powerbi.com/t5/Power-Query/Split-text-based-on-every-second-delimiter/m-p/865873

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

As metioned by @Greg_Deckler

If the names are not  many, you can split them all, and then merge   name and Last name  columns one by one.

 

2012.png

2014.png

 

2015.png

 

You also can refer  to this artice, if there are too many names.

https://community.powerbi.com/t5/Power-Query/Split-text-based-on-every-second-delimiter/m-p/865873

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

Well, you could do this:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcklNzs5JLdJxL0pN13HKyS/X8cpP1QnOS01N0QlOzFWKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5", "Column1.6"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}, {"Column1.3", type text}, {"Column1.4", type text}, {"Column1.5", type text}, {"Column1.6", type text}}),
    #"Merged Columns" = Table.CombineColumns(#"Changed Type1",{"Column1.1", "Column1.2"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged"),
    #"Merged Columns1" = Table.CombineColumns(#"Merged Columns",{"Column1.3", "Column1.4"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged.1"),
    #"Merged Columns2" = Table.CombineColumns(#"Merged Columns1",{"Column1.5", "Column1.6"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged.2")
in
    #"Merged Columns2"

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.