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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
adavid999
Helper V
Helper V

Split column where ",*"

hello, does anyone know how I could split column where I have string ",t" (that is a comma and no space before next character).

 

Here the "t" is an example, the letters vary.

 

Example:

 

"sports includes football, tennis,badminton"

 

I would like new column for "badminton". The delimiter is comma and no space before the "b". The sports vary but the constant is comma and no space. I hoped I could use a wildcard delimiter like ",*" but this does not work.

 

Is this possible?

 

Many thanks,

 

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @adavid999 

Place the following M code in a blank query to see the steps:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKi7ILyopVsjMS84pTUktVkjLzy9JSszJ0VEoSc3LyyzWSUpMyc3MK8nPU4rVIUJ5RmJeCkhAKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Col1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Col1", type text}}),

    #"Split Column by Character Transition" = Table.SplitColumn(#"Changed Type", "Col1", Splitter.SplitTextByCharacterTransition({","}, (c) => List.Contains({"a".."z", "A".."Z" }, c)), {"Col1.1", "Col1.2"})
in
    #"Split Column by Character Transition"

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

3 REPLIES 3
AlB
Community Champion
Community Champion

@adavid999 

You would have to create a new step with that code, best in the Advanced editor and change #"Changed Type" for the name of your previous step in the query and "Col1" for the name of the column with the data. 

If you have share a pbix with your data (or some mock data with the same table structure we will be able to work it out

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

adavid999
Helper V
Helper V

thank @aib, I see that this works in your example but I am struggling to get it to work on my data. Specifically I am unsure how to apply this to my existing variables. I have no idea about M code.

 

Is it a case of writing the following in the formula bar and changing the "Col1" names?

 

= Table.SplitColumn(#"Changed Type", "Col1", Splitter.SplitTextByCharacterTransition({","}, (c) => List.Contains({"a".."z", "A".."Z" }, c)), {"Col1.1", "Col1.2"})

Best,

Adam

AlB
Community Champion
Community Champion

Hi @adavid999 

Place the following M code in a blank query to see the steps:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKi7ILyopVsjMS84pTUktVkjLzy9JSszJ0VEoSc3LyyzWSUpMyc3MK8nPU4rVIUJ5RmJeCkhAKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Col1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Col1", type text}}),

    #"Split Column by Character Transition" = Table.SplitColumn(#"Changed Type", "Col1", Splitter.SplitTextByCharacterTransition({","}, (c) => List.Contains({"a".."z", "A".."Z" }, c)), {"Col1.1", "Col1.2"})
in
    #"Split Column by Character Transition"

 

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.