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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Betty888
Helper II
Helper II

How to extract specific number of characters before a delimiter occuring several times?

Dear all,

I have a column that looks like : 

01/ dddddd

02/ aaaaaaa

03/ nnnnnnn

and I need to split into 2 columns in a way : 

- colonne 1 : the 2 characters before the delimiter ( / ) and separate them by "#(lf)"

- colonne 2 : the text between delimiters :  "/" and "#(lf)"

Thanks a lot for your help ! 

1 ACCEPTED SOLUTION

Hi @Betty888 ,

Nathaniel_C_0-1687741055060.png

You can choose split at each occurence, or you can choose the rightmost or the leftmost occurrence.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Nathaniel_C
Community Champion
Community Champion

Hi @Betty888 ,
Please try this - go to Power Query, go to the Transform tab, Split the column using "/" then trim the column to get this.image.png
Here is the code that you can paste into the Advanced Editor

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUV0gBA6VYHSDXSF8hEQIgfGN9hTwIUIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable 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"}),
    #"Trimmed Text" = Table.TransformColumns(#"Split Column by Delimiter",{{"Column1.2", Text.Trim, type text}})
in
    #"Trimmed Text"

 
Let me know if you have any questions on any of the steps.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @Nathaniel_C ,

many thanks for your reply 🙏

This works perfectly when I have the delimiter "/" occuring once, but in my case, it could happen that I have in the same cell, the occurence of this situation several times, do you have any idea how can I fix that? 

Many thanks again!

Hi @Betty888 ,

Nathaniel_C_0-1687741055060.png

You can choose split at each occurence, or you can choose the rightmost or the leftmost occurrence.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors