Forum Discussion
Anonymous
1 year agoNot applicable
Wrong calculation when working with decimals
Hi, I'm calculating a column that is just the product of two other columns, it works fin for most of the rows (the ones that have 9 decimal places) but it does not work when the cell from one of ...
- 1 year ago
Anonymous I can't replicate this behavior. That said, it looks like your Retornos.LM column is not a decimal number but rather text given its formatting ( right-justified and not italicized ) so maybe that is the issue?
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LcrBDcAwCAPAXXinkWtIwLNE7L9GVKnvu3PswcSyYbPkSlGITG5ajx+DUSn/zosNIqFFppd1Xw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}, {"Column2", type number}}), #"Inserted Multiplication" = Table.AddColumn(#"Changed Type", "Multiplication", each [Column2] * [Column1], type number), #"Changed Type1" = Table.TransformColumnTypes(#"Inserted Multiplication",{{"Multiplication", Percentage.Type}}) in #"Changed Type1"
Greg_Deckler
Community Champion
1 year agoAnonymous I can't replicate this behavior. That said, it looks like your Retornos.LM column is not a decimal number but rather text given its formatting ( right-justified and not italicized ) so maybe that is the issue?
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LcrBDcAwCAPAXXinkWtIwLNE7L9GVKnvu3PswcSyYbPkSlGITG5ajx+DUSn/zosNIqFFppd1Xw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}, {"Column2", type number}}),
#"Inserted Multiplication" = Table.AddColumn(#"Changed Type", "Multiplication", each [Column2] * [Column1], type number),
#"Changed Type1" = Table.TransformColumnTypes(#"Inserted Multiplication",{{"Multiplication", Percentage.Type}})
in
#"Changed Type1"- Anonymous1 year agoNot applicable
Greg_Deckler you're right, it was formatted as text, thanks!