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
jmdlb
Regular Visitor

Text.AfterDelimiter tricky

Hi!

 

I have to extract some text from a field after N commas (","), so I use Text.AfterDelimiter with optional index to specify hoy many of those characters commas I want to jump. The tricky part is that number is specified in another field of the table.

 

Example
Text = "BOT/test1/test2,BOT/test3,hello world"
Number of comma to jump = 2 (given in another field of the table)
What I want= "hello world"
 Table.TransformColumns(#"Columna duplicada", {{"Results", each Text.AfterDelimiter(_,",",2) , type text}})

 

I want to replace "2" with the value of the field of the table which specify how many comas I have to jump, but I get an error.

I would like something like this:
= Table.TransformColumns(#"Columna duplicada", {{"Results", each Text.AfterDelimiter(_, ",", [CommaJump] ) , type text}})

The error I got is "Expression.Error: We cannot apply field access to the type Text."

 

Thankss a lot!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

You will need to use Table.ReplaceValue for this. 

= Table.ReplaceValue(#"Columna duplicada",each [Results],each Text.AfterDelimiter([Results], ",", [CommaJump] ),Replacer.ReplaceValue,{"Results"})

View solution in original post

3 REPLIES 3
Vijay_A_Verma
Super User
Super User

You will need to use Table.ReplaceValue for this. 

= Table.ReplaceValue(#"Columna duplicada",each [Results],each Text.AfterDelimiter([Results], ",", [CommaJump] ),Replacer.ReplaceValue,{"Results"})

Genius! Thanks 🙂

HotChilli
Super User
Super User

I don't think you can use Table.TransformColumns for this.  Probably have to add a custom column

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