Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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.
Solved! Go to Solution.
_ 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.
_ 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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 5 | |
| 5 | |
| 3 |