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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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
March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.