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
jayblog
Frequent Visitor

Convert mixed column Hexadecimal to Decimal in DAX or Power Query

I have a column that has mixed hexadecimal MEIDs (mobile equipment identifier - 14 characters) and decimal MEIDs (18 characters).  I'd like to convert the hexadecimal MEIDs in the column to decimal and leave the decimal ones alone.

 

I used this formula in Excel to accomplish the task, but I can't get my DAX or Power Query attempts to work.  Any help would be appreciated.

 

=IF(LEN(A2)=14,CONCATENATE(TEXT(HEX2DEC(LEFT(A2,8)),"0000000000"),TEXT(HEX2DEC(RIGHT(A2,6)),"00000000")),(A2))

 

*Red text denotes the Excel cells.

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

@jayblog,

 

You may add a custom column as follows.

if Text.Length([Column1]) = 14 
then Text.PadStart(Text.From(Expression.Evaluate("0x" & Text.Start([Column1], 8))), 10, "0") 
& Text.PadStart(Text.From(Expression.Evaluate("0x" & Text.End([Column1], 6))), 8, "0") 
else [Column1]
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@jayblog,

 

You may add a custom column as follows.

if Text.Length([Column1]) = 14 
then Text.PadStart(Text.From(Expression.Evaluate("0x" & Text.Start([Column1], 8))), 10, "0") 
& Text.PadStart(Text.From(Expression.Evaluate("0x" & Text.End([Column1], 6))), 8, "0") 
else [Column1]
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you! Worked perfectly!

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.