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
pbrainard
Helper III
Helper III

extract everything except...

I have a delimited list of items. I want to be able to create a new column and extract a specific portion on the list. I want to extract the 'other' comments, from the constants. The list of constants is:

 

bonus program

recgonition efforts

wellness program

anniversaries

 

other (this is the part I want to extract)

 

So in line one, below, I want to extract - more vending options

in line two, I want to extract - more time off

in line three, I don't want to extract anything (maybe a null value to the new column)

 

 

bonus program;recognition efforts;wellness program;anniversaries;more vending options;
recognition efforts;bonus program;more time off;wellness program;
wellness program;bonus program;anniversaries;

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @pbrainard 

 

Download sample PBIX with the following code

 

You can do this in Power Query with this code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY5BCsMwDAS/InzOD/wU44PTro0gloLkpt8vzSWY5LrszmxKYVX5OO2mzUqPhpc24cEqhFrVhscvtk3gV6mI8AHzYgyPXQ10QN4sjXT/Tz2GvKTwBJt153ZwB2mtd9FJuaUzYj4Tcv4B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Comments = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Comments", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Combine(List.RemoveItems(Text.Split([Comments], ";"), {"bonus program", "recognition efforts", "wellness program", "anniversaries"})))
in
    #"Added Custom"

 

comments.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @pbrainard 

 

Download sample PBIX with the following code

 

You can do this in Power Query with this code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY5BCsMwDAS/InzOD/wU44PTro0gloLkpt8vzSWY5LrszmxKYVX5OO2mzUqPhpc24cEqhFrVhscvtk3gV6mI8AHzYgyPXQ10QN4sjXT/Tz2GvKTwBJt153ZwB2mtd9FJuaUzYj4Tcv4B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Comments = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Comments", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Combine(List.RemoveItems(Text.Split([Comments], ";"), {"bonus program", "recognition efforts", "wellness program", "anniversaries"})))
in
    #"Added Custom"

 

comments.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.

Top Solution Authors