Forum Discussion

Jerome22's avatar
Jerome22
Resolver I
2 years ago

sum return (near) incorrect result (rounding issue???)

hi,

 

I just found a strange issue.

I have a table in a Fabric Lakehouse with an amount column = 572.36

If I do a sum of the column, the result is : 572.3599853515625

 

the amount column is a real type

 

my 2 queries:


select [Amount]
from DetailedCustLedgEntry dd
where  [CustLedgerEntryNo]= '100496'

select sum([Amount])
from DetailedCustLedgEntry dd
where  [CustLedgerEntryNo]= '100496'

pretty simple, in my test there is 1 and only 1 row matching my customer, so the sum is summing 1 row only.
if I cast my column to a money type, the rounding issue disappear.
 
it's not a big deal, but a strange behavior.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Jerome22 ,

    Thanks for using Fabric Community.

    Data type of the column is double.



    Query 1:

     

    Query 2:


    I can find results from both the queries are same when data type is double.

    Data types - Microsoft Fabric | Microsoft Learn


    Hope this is helpful. Please let me know incase of further queries.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Jerome22 ,

      We haven’t heard from you on the last response and was just checking back to see if your query was answered.
      Otherwise, will respond back with the more details and we will try to help .

      Thanks

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Jerome22 ,

        We haven’t heard from you on the last response and was just checking back to see if your query was answered.
        Otherwise, will respond back with the more details and we will try to help .

        Thanks