March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have below line:
= Table.TransformColumnTypes(#"Filtered Rows",{{"userId", Int64.Type}})
this changes column to whole numbers, on some lines this drops errors. I have tried below
= try Table.TransformColumnTypes(#"Filtered Rows",{{"userId", Int64.Type}}) otherwise null
but it doesn't work. It still shows errors.
What I would like achieve is:
convert to whole numbers, if error leave as text
thanks
dan
Solved! Go to Solution.
Hello @Anonymous
this is because Table.TransformColumnTypes is applied at once. When you get an error means that the content isn't suitable for the change. However this means the column type can't be changed - only on cell level. This can be achieved by applying a TransformColumns only. See here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmAyMSkZTOvqgqmS1OISpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Number = _t]),
TransformColumn =Table.TransformColumn
(
Source,
{
{
"Number", each try Number.From(_) otherwise _, type any
}
}
)
in
TransformColumn
Copy paste this code to the advanced editor to see how the solution works
If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun
Jimmy
Hello @Anonymous
this is because Table.TransformColumnTypes is applied at once. When you get an error means that the content isn't suitable for the change. However this means the column type can't be changed - only on cell level. This can be achieved by applying a TransformColumns only. See here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmAyMSkZTOvqgqmS1OISpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Number = _t]),
TransformColumn =Table.TransformColumn
(
Source,
{
{
"Number", each try Number.From(_) otherwise _, type any
}
}
)
in
TransformColumn
Copy paste this code to the advanced editor to see how the solution works
If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun
Jimmy
Hi,
thanks for explanation, much appreciated.
dan
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
34 | |
30 | |
19 | |
19 | |
12 |