cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Route11 Member
Member

Custom Column to extract STRING

Hi Experts

 

How would you extract all data from column Work Type that has in the string of text the letter ABC and or BCD anywhere in the string...into a new column and all other entries are blank in the new column.. so see example below....

 

see imageCapture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Stachu Super Contributor
Super Contributor

Re: Custom Column to extract STRING

try this PowerQuery code, apply it in Add Column>Custom Column window

[
abc = Text.PositionOf([Work Type],"ABC"),
bcd = Text.PositionOf([Work Type],"BCD"),
resultABC = if abc <> -1 then Text.Middle([Work Type],abc,3) else null,
resultBCD = if bcd <> -1 then Text.Middle([Work Type],bcd,3) else null,
result = Text.Combine({resultABC, resultBCD})
][result]
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Stachu Super Contributor
Super Contributor

Re: Custom Column to extract STRING

try this PowerQuery code, apply it in Add Column>Custom Column window

[
abc = Text.PositionOf([Work Type],"ABC"),
bcd = Text.PositionOf([Work Type],"BCD"),
resultABC = if abc <> -1 then Text.Middle([Work Type],abc,3) else null,
resultBCD = if bcd <> -1 then Text.Middle([Work Type],bcd,3) else null,
result = Text.Combine({resultABC, resultBCD})
][result]
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

Route11 Member
Member

Re: Custom Column to extract STRING

Stachu...Excellent feedback....and happy to learn also....thank you

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 345 members 3,323 guests
Please welcome our newest community members: