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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
KelliKnitsAlot
Helper II
Helper II

Replacing Text at Beginning of String

Good morning! I need to replace text at the beginning of a string. I cannot use the REPLACE VALUES function because I have the same text in other cells. I tried using Text.TrimStart in M query but either get an error or just "DIR". See example of data below. End result needed would be ABCD, EFG, HIJK, LMNO DIRECTORATE 2, etc....... 

String.PNG

 

 

 

 

 

Any assistance would be appreciated.

1 ACCEPTED SOLUTION
freginier
Solution Specialist
Solution Specialist

Create custom column in Power Query

if Text.StartsWith([Column1], "DIR") then Text.AfterDelimiter([Column1]," ") else [Column1]

View solution in original post

2 REPLIES 2
freginier
Solution Specialist
Solution Specialist

Create custom column in Power Query

if Text.StartsWith([Column1], "DIR") then Text.AfterDelimiter([Column1]," ") else [Column1]

Thank you!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.