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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
stino123
Helper II
Helper II

Removing first three digits if they are "000"

Hey All,

 

I have the below order number string of data. In most cases there is three 0's prior to the actual order number however sometimes there is not. Is there a function that removes the first three digits only  if those first three digits are "000"? Thanks in advance!

 

stino123_0-1643876587404.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@stino123 , a new column in power query

if Text.Start([Column], 3) = "000" then Text.Replace([Column], "000", "")  else [Column])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

Simple Text.TrimStart() is enough,

CNENFRNL_0-1643879370638.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

stino123
Helper II
Helper II

sorry @amitchandak  still pretty new to power bi what are the functions for: text.start, Then, text replace, else?

 

Thanks!

@stino123 , this is power Query code to be used in Transform data module

Text.Start to get first few character , 3 in this case

Text.Replace will replace data in a text

 

Text.Start, Text.Middle, Text.End: https://www.youtube.com/watch?v=vky4wPqm0O0 

 

https://docs.microsoft.com/en-us/powerquery-m/text-replace

 

Power Query Replace Value: https://youtu.be/hkZhZbR7Kmk

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@stino123 , a new column in power query

if Text.Start([Column], 3) = "000" then Text.Replace([Column], "000", "")  else [Column])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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
Top Kudoed Authors