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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
LiliLPo
Frequent Visitor

Spliting column by different delimiters and different location of the text

Hi, I realy need help to extract the data(comment part) above the yelow line and this needs to be dynamic. 

3 problems that I have: 

1. the comment is not always at the same place 

2. the delimitars for start and end are different. 

3. The length of the comment is different in each row

 

I have tried many solutions that I have found online but nothing realy works 

I will appriciate forany advice/help with this 

Thanks Lili

 

capture.png

 

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

You do not state how you want the output represented, so I am presenting it as concatenated text strings (concatenated with a Line Feed)

  • Split on the colon
  • Then split each sublist on the /
  • The comments will be the last item in each sublist
  • If that last item is blank ("") then delete it
let
    Source = Table.FromColumns(
        {{"PLR/93170/TC heavy rates. premier Test:BON/17423/",
         "PLR/65559/retail falt rate, 40 ft RV Test Inc FSC 253.90",
         "BAS/68050/Test Verified, closest available driver:BON/00276/1st call Member gave wrong location"
        }}, type table[Column1=text]
    ),
    #"Added Custom" = Table.AddColumn(Source, "comment", each Text.Combine(
            List.RemoveItems(
                List.Accumulate(
                    List.Transform(Text.Split([Column1],":"),
                        each Text.Split(_,"/")), 
                    {},
                    (state, current)=>
                    state & {List.Last(current)}),
                {""}),
            "#(lf)"))
in
    #"Added Custom"

 

ronrsnfld_0-1677550214160.png

 

 

View solution in original post

2 REPLIES 2
LiliLPo
Frequent Visitor

Thank you very much 🙂

ronrsnfld
Super User
Super User

You do not state how you want the output represented, so I am presenting it as concatenated text strings (concatenated with a Line Feed)

  • Split on the colon
  • Then split each sublist on the /
  • The comments will be the last item in each sublist
  • If that last item is blank ("") then delete it
let
    Source = Table.FromColumns(
        {{"PLR/93170/TC heavy rates. premier Test:BON/17423/",
         "PLR/65559/retail falt rate, 40 ft RV Test Inc FSC 253.90",
         "BAS/68050/Test Verified, closest available driver:BON/00276/1st call Member gave wrong location"
        }}, type table[Column1=text]
    ),
    #"Added Custom" = Table.AddColumn(Source, "comment", each Text.Combine(
            List.RemoveItems(
                List.Accumulate(
                    List.Transform(Text.Split([Column1],":"),
                        each Text.Split(_,"/")), 
                    {},
                    (state, current)=>
                    state & {List.Last(current)}),
                {""}),
            "#(lf)"))
in
    #"Added Custom"

 

ronrsnfld_0-1677550214160.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.