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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Nurzh_17
Frequent Visitor

Remove certain part of string based on value from other column

Hello all, 

I have issue with removing certain part of string value in my column. 

Example: 

Table "Document"

DocumentNumberDocumentSourceCategory
61-2300-B-PID-2350-01Master Document
61-2300-B-PID-2350-01-07812Project Working Copy
61-2300-B-PID-2350-01-07917DProject Working Copy
61-2300-B-PID-2350-01-07917Project Working Copy
61-2300-B-PID-2350-01-14398Project Working Copy
61-2300-B-PID-2350-01-00209Project Working Copy
61-2300-B-PID-2350-01-07812-21Project Working Copy
61-2300-B-PID-2350-01-05209DProject Working Copy
61-2300-B-PID-2350-01-07812-21D1Project Working Copy
61-2300-B-PID-2350-01-05908Project Working Copy
61-2300-B-PID-2350-01-07812DProject Working Copy
61-2300-B-PID-2350-01-05209Project Working Copy
61-2300-B-PID-2350-01-03210DProject Working Copy
61-2300-B-PID-2350-01-07812-21PProject Working Copy
61-2300-B-PID-2350-01-07812-21DProject Working Copy
61-2300-B-PID-2350-01-03210Project Working Copy

 

Desired New Column that will identify us the Master Document Number of this copies: 

 

DocumentNumberDocumentSourceCategoryDocument cut
61-2300-B-PID-2350-01Master Document61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07812Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07917DProject Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07917Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-14398Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-00209Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07812-21Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-05209DProject Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07812-21D1Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-05908Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07812DProject Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-05209Project Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-03210DProject Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07812-21PProject Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-07812-21DProject Working Copy61-2300-B-PID-2350-01
61-2300-B-PID-2350-01-03210Project Working Copy61-2300-B-PID-2350-01

 

Thank you!

 

1 REPLY 1
some_bih
Super User
Super User

Hi @Nurzh_17 one possible solution could be to create new column in Power query using M function Text.Start

(I recognize pattern from your picture: first 21 character should retrive):

New column Document cut code is

= Table.AddColumn(#"Promoted Headers", "Document cut", each Text.Start([DocumentNumber],21))

I hope this help

some_bih_0-1685446646790.png

 





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

Proud to be a Super User!






Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.