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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
Super User
Super User

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Top Kudoed Authors