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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
data123
Frequent Visitor

Extraction with Text Between Delimiters not working

Hello,

 

I am trying to extract full names for a column. The coulmn is in case table. I want to extract the names and count the number of cases against each name. I am using text between delimters function to extract the names. First delimiter- "@" Second delimiters- "Space."

 

When I give value of 1 to the 'number of end delimters to skip' it doesn't recognize the space between the first name and last name and extracts an extra word after the name.

 

When I give value of 0 to the 'number of end delimters to skip' it does recognize the space between the first name and last name and extracts only the first name.

 

What should I do so that I can extract just the full name(Both first and last).  I have attached screenshots below for reference.

 

Thanks,

Shubham Keshri.

 

image.pngimage.pngimage.pngimage.png

1 ACCEPTED SOLUTION

As I suspected @data123 - those aren't spaces. Look at this:

edhans_0-1613503322744.png

The character after the Y in Ashley's name is a space - ASCII code 32.

The characters after the S in her last name is char 63 and char 160. Char 160 is an HTML  non-breaking space. 63 is a quesion mark, which isn't showing. It is because in reality it is a high ASCII non-printable character. I can select it and copy/paste it, but as you can see below, I cannot see it. Excel cannot see it properly either which is why it reports it as 63. But Power Query can. It is ASCII character 8203 which is being inserted by your software.

edhans_1-1613503535020.png

So visually you and I see a space after "hodges" but Power Query sees that invisible character, plus the non-breaking space (ASCII 160)

So I added to Replace statements after the initial import, and before the Text.BetweenDelimiters function:

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Replaced Value" = Table.ReplaceValue(Source,Character.FromNumber(8203),"",Replacer.ReplaceValue,{"ETL"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",Character.FromNumber(160)," ",Replacer.ReplaceText,{"ETL"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value1", "Custom", each Text.BetweenDelimiters([ETL], "@", Character.FromNumber(32), 0, 1))
in
    #"Added Custom"

 

 

Likely only the 2nd one is needed - it will replace all non-breaking spaces with a space (160 to 32) then Text.BetweenDelimiters works.

edhans_2-1613503942022.png

I was doing some testing, so you can replace:

 

Text.BetweenDelimiters([ETL], "@", Character.FromNumber(32), 0, 1)

 

with

 

Text.BetweenDelimiters([ETL], "@", " ", 0, 1)

 

It is the same thing.

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

10 REPLIES 10
edhans
Super User
Super User

See this code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RYwxCsMwEAS/sqjOI0RKg5vYnXCh4JMlkO/MScHo91acIrDV7DDOmTmmgr6gssMOFAKmPdUIYdRIUDpEq1keztjRa8MgTAWnSqUupHJfdyX6ApbOePv5T3lj/OgR218iXnF++3byOTe8qLHktWeWCw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Text.BetweenDelimiters([Column1], "@", " ", 0, 1))
in
    #"Added Custom"

It works on my sample data just fine.

edhans_0-1613415265595.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hi edhans,

 

I am using the exact same code you used but it doesn't work for me. It exacts an extra word after the last name.

 

Source = Table.Combine({#"Case Feed Report_sk_Yr2017-19", #"Case Feed Report_sk_Yr2020", #"Case Feed Report_sk_Yr2021"}),
#"Duplicated Column" = Table.DuplicateColumn(Source, "Body", "Body - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"Body - Copy", "ETL"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date/Time Opened", type datetime}}),
#"Inserted Text Between Delimiters" = Table.AddColumn(#"Changed Type", "Text Between Delimiters", each Text.BetweenDelimiters([ETL], "@", " ", 0, 1), type text),
#"Renamed Columns1" = Table.RenameColumns(#"Inserted Text Between Delimiters",{{"Text Between Delimiters", "First Name"}}),
#"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns1",{"Case Number", "Closed", "Date/Time Opened", "Date/Time Closed", "Body", "ETL", "First Name"})
in
#"Reordered Columns"

 

 

sss.JPG

Then your data isn't the same. Mine is 100% spaces. You might have hard spaces (ASCII code 160) or some other weird char that looks like a space (char 32) but isn't. You'd have to share a data file via OneDrive/Dropbox (Excel or CSV) for me to test with as pasting it in the forum will convert the ASCII.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hi Edhans,

 

I have uploaded the excel file on drop box. The link to the file is below.

 

https://www.dropbox.com/scl/fi/4ehf8bbw4gm4l6mko90ss/Escalation-Data.xlsx?dl=0&rlkey=86aj3zyprl3k8ny...

 

Thanks,

Shubham

Hi Edhans,

 

There is some problem with the above link. It just wont open. I am attaching a new dropbox link below. Let me know if you can access the file.

 

https://www.dropbox.com/scl/fi/4ehf8bbw4gm4l6mko90ss/Escalation-Data.xlsx?dl=0&rlkey=86aj3zyprl3k8ny... 

I have it. looking at it now @data123 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

As I suspected @data123 - those aren't spaces. Look at this:

edhans_0-1613503322744.png

The character after the Y in Ashley's name is a space - ASCII code 32.

The characters after the S in her last name is char 63 and char 160. Char 160 is an HTML  non-breaking space. 63 is a quesion mark, which isn't showing. It is because in reality it is a high ASCII non-printable character. I can select it and copy/paste it, but as you can see below, I cannot see it. Excel cannot see it properly either which is why it reports it as 63. But Power Query can. It is ASCII character 8203 which is being inserted by your software.

edhans_1-1613503535020.png

So visually you and I see a space after "hodges" but Power Query sees that invisible character, plus the non-breaking space (ASCII 160)

So I added to Replace statements after the initial import, and before the Text.BetweenDelimiters function:

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Replaced Value" = Table.ReplaceValue(Source,Character.FromNumber(8203),"",Replacer.ReplaceValue,{"ETL"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",Character.FromNumber(160)," ",Replacer.ReplaceText,{"ETL"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value1", "Custom", each Text.BetweenDelimiters([ETL], "@", Character.FromNumber(32), 0, 1))
in
    #"Added Custom"

 

 

Likely only the 2nd one is needed - it will replace all non-breaking spaces with a space (160 to 32) then Text.BetweenDelimiters works.

edhans_2-1613503942022.png

I was doing some testing, so you can replace:

 

Text.BetweenDelimiters([ETL], "@", Character.FromNumber(32), 0, 1)

 

with

 

Text.BetweenDelimiters([ETL], "@", " ", 0, 1)

 

It is the same thing.

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hi @edhans,

 

Thank you so much! Its working for me.

 

Thanks,

Shubham.

Glad to help @data123 - those "invisible" characters can be the toughest to undersand and figure out why it seems the code isn't working.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans Yes they are! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.