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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
amaaiia
Super User
Super User

Decimal column to hexadecimal with Dataflow Gen2

I am trying to add a new column to my table via Dataflow Gen2, so that my new column HEXNumber has to be as my old column DECNumber converted to Hexadecimal. So first, I've duplicated DECNumber and renamed it as HEXNumber, so for the moment HEXNumber=DECNumber. Now, for HEXNumber to be in hexadecimal, I'm trying with:

 

 

Table.TransformColumns(#"Renamed columns", {{"HEXNumber", each Number.ToText(_, "x") , Text.Type}})

 

 

 

But it's not working. If I change _ to a random number (45), it works, the HEXNumber column is 45 converted to Hexadecimal.

 

 

Table.TransformColumns(#"Renamed columns", {{"HEXNumber", each Number.ToText(45, "x") , Text.Type}})

 

 

 

But what I need is to convert each Decimal number into Hexadecimal, not always 45. I don't know what do I have to write where _ is written.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

_ usually identifies the entire row.  You would need to use something like _[DECNumber] or just [DECNumber]

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjFVitWJVjKzAFMmRmDK0NAYTBsbGCjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [DECNumber = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"DECNumber", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "HEXNumber", each Number.ToText([DECNumber],"x"))
in
    #"Added Custom"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

_ usually identifies the entire row.  You would need to use something like _[DECNumber] or just [DECNumber]

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjFVitWJVjKzAFMmRmDK0NAYTBsbGCjFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [DECNumber = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"DECNumber", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "HEXNumber", each Number.ToText([DECNumber],"x"))
in
    #"Added Custom"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.