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
rootsmusic
Helper I
Helper I

extract text after delimiter using a delimiter column

I have a [target] column and a [delimiter] column.  The [delimiter] column has values that I want to use as delimiter for the [target] column's values.  How can I extract text after delimiter (the [delimiter] column's values) and not create another column?  Alternatively, I can also find the [delimiter]'s value within the [target] column and replace with "" (empty string).  Thanks!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

If you want result in another column and 

= Text.AfterDelimiter([target],[delimiter])

For in column replacement, insert following statement i.e. not create another column

= Table.ReplaceValue(Source,each [target],each Text.AfterDelimiter([target],[delimiter]),Replacer.ReplaceValue,{"target"})

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSqxJUtJRqlGK1YlWSk7xzNLJzskFCugoxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [target = _t, delimiter = _t]),
    Custom1 = Table.ReplaceValue(Source,each [target],each Text.AfterDelimiter([target],[delimiter]),Replacer.ReplaceValue,{"target"})
in
    Custom1

 

View solution in original post

6 REPLIES 6
Vijay_A_Verma
Super User
Super User

If you want result in another column and 

= Text.AfterDelimiter([target],[delimiter])

For in column replacement, insert following statement i.e. not create another column

= Table.ReplaceValue(Source,each [target],each Text.AfterDelimiter([target],[delimiter]),Replacer.ReplaceValue,{"target"})

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSqxJUtJRqlGK1YlWSk7xzNLJzskFCugoxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [target = _t, delimiter = _t]),
    Custom1 = Table.ReplaceValue(Source,each [target],each Text.AfterDelimiter([target],[delimiter]),Replacer.ReplaceValue,{"target"})
in
    Custom1

 

Nathaniel_C
Super User
Super User

Hi @rootsmusic ,
First picture see first 2 columns

Second picture see splitting at the "a" (for example and if there is no "a" then it will add the second col to the end.)

Third picture combine the three columns using Text.combine


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

Nathaniel_C_0-1653421434874.pngNathaniel_C_1-1653421485120.pngNathaniel_C_2-1653421573550.png

 







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

Proud to be a Super User!




Hi @rootsmusic ,
BTW, and you may know this already, but after you have done your calcs in Power Query, you can remove all those intermediate columns that you used to create your "result" column.

 


Nathaniel





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

Proud to be a Super User!




Nathaniel_C
Super User
Super User

Hi @rootsmusic ,
Select your column, select the transform tab, select the Extract button. See pictures below

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

Nathaniel_C_0-1653413225890.png

Nathaniel_C_1-1653413295367.png

 

 





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

Proud to be a Super User!




I know how to extract "text after delimiter" by manually inputting text into the "delimiter" field, i.e. Text.AfterDelimiter(_, "delimiter").  Please reference my question about using a [delimiter] column.

Hi @rootsmusic , 
I was responding to this part of your question..."How can I extract text after delimiter and not create another column?"

Nathaniel





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

Proud to be a Super User!




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.

Top Solution Authors
Top Kudoed Authors