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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not 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 the columns has fewer decimal places. Any idea of why this might be?

The calculated column "Contribución" is the product of "Retornos.LM" and "Porcentaje Rebalanceado"

 

rmm_0-1736781006212.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@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"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@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"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler you're right, it was formatted as text, thanks! 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.