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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ShaneL79
Helper I
Helper I

Leading zeros for alphanumeric columns

Hello Everyone,

 

I have two different data sources that I am trying to connect using system IDs. The problem is that there is no consistency in how the two departments have named the systems.  

 

Example:

 

Source 1 - System NamesSource 2 - System Names
011
022

03A

3A
1515
30033003

 

Basically, on the first three rows a leading zero is needed. The last two are okay.

 

I have found plenty of resources for adding a leading zero, but none cover different length of values or values that contain a letter. 

 

Any idea how to make source 2 look the same as source 1?

 

Thank you.

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @ShaneL79 ,

 

Try adding a custom column in the PowerQuery editor:

if Text.StartsWith([System Names],"0") then Text.Range([System Names],1) else [System Names]

vcgaomsft_0-1675660877684.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @ShaneL79 ,

 

Try adding a custom column in the PowerQuery editor:

if Text.StartsWith([System Names],"0") then Text.Range([System Names],1) else [System Names]

vcgaomsft_0-1675660877684.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Thank you. This worked.

lbendlin
Super User
Super User

What if Source 1 all of a sudden has both  03A and 3A  system names (and they signify different systems) ?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.