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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
PeteyG
Helper I
Helper I

Removing only 1 leading Zero if there is one.

Good afternoon. 

I originally attempted to trim the Zeros but it trims all the zeros and leaves it blank.  I can just trim the 1st character becuase of numbers over 10 and ones that begin with letters.  Anyone have tips on If number starts with a zero trim 1 space otherwise ignore?

I have thousands of rows that look a bit like this:

Rev
00
01
02
03
04
10
12
15
A
B
C
D

 

I need it too look like:

 

Rev
0
1
2
3
4
10
12
15
A
B
C
D
1 ACCEPTED SOLUTION
Juan-Power-bi
Resident Rockstar
Resident Rockstar

Try this in Power Query as a custom column:
if Text.StartsWith([YourColumn], "0") then Text.RemoveRange([YourColumn], 0, 1) else [YourColumn]
That checks if the value starts with a zero and removes just the first character if so, otherwise leaves it alone. Works fine for "Rev", "A", "10", etc.

View solution in original post

3 REPLIES 3
dufoq3
Community Champion
Community Champion

Hi @PeteyG, another solution:

 

Value.FromText([Rev])


Output

dufoq3_0-1775823127360.png

Value.FromText([Rev])

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Juan-Power-bi
Resident Rockstar
Resident Rockstar

Try this in Power Query as a custom column:
if Text.StartsWith([YourColumn], "0") then Text.RemoveRange([YourColumn], 0, 1) else [YourColumn]
That checks if the value starts with a zero and removes just the first character if so, otherwise leaves it alone. Works fine for "Rev", "A", "10", etc.

Fantastic!  Thank you!

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.