Rounding error in a calculated field
Resolved
Hello,
660/22*5=150 but 5/22*660=150.0000000000000000000000000000000000000000000000018
When I manually created a calculated field using 5/22*660 it gave 150. However when I am using the actual fields in the calculation, I will get that rounding error. My guess would be that this error is caused by the fact, that the 5 comes from a different data connection than 22 and 660.
All the best
Siim N
Hi Siim,
Thanks for reaching out. I believe the pertinent question here would be are there any aggregations applied to the fields being referenced by your non-manual Calculated Field?
When using Calculated Fields Yellowfin looks at the underlying data without aggregations applied. For a quick example of how the results could vary, let's say each number corresponds with the following fields in the report itself:
5 = (Items)
22 = (Inventory)
660 = SUM(Sales)
So if you made a Simple Calculated Field as:
may have different results than depending on your underlying data. Best practice would be to match the aggregations set on top of your data at the report level in your calculated field as well.Another possibility here is that the above doesn't apply to this case but perhaps there is some sort of other formatting applied to one or more of these fields and/or that if you looked at the underlying data itself and executed this statement (by running the SQL statement Yellowfin generates directly against the RDBMS), then you might see that "150.0000000000000000000000000000000000000000000000018" is your actual result.
That said, I'm unsure why it would be the case you'd be using so many decimal places. Any standard Decimal places, usually 2, would still display 150.00 here. Can you perhaps explain a little more on your use case here if this is required?
Thanks,
Mike
Hi Siim,
Thanks for reaching out. I believe the pertinent question here would be are there any aggregations applied to the fields being referenced by your non-manual Calculated Field?
When using Calculated Fields Yellowfin looks at the underlying data without aggregations applied. For a quick example of how the results could vary, let's say each number corresponds with the following fields in the report itself:
5 = (Items)
22 = (Inventory)
660 = SUM(Sales)
So if you made a Simple Calculated Field as:
may have different results than depending on your underlying data. Best practice would be to match the aggregations set on top of your data at the report level in your calculated field as well.Another possibility here is that the above doesn't apply to this case but perhaps there is some sort of other formatting applied to one or more of these fields and/or that if you looked at the underlying data itself and executed this statement (by running the SQL statement Yellowfin generates directly against the RDBMS), then you might see that "150.0000000000000000000000000000000000000000000000018" is your actual result.
That said, I'm unsure why it would be the case you'd be using so many decimal places. Any standard Decimal places, usually 2, would still display 150.00 here. Can you perhaps explain a little more on your use case here if this is required?
Thanks,
Mike
Hi Siim,
I just wanted to check in and see how things are going with this.
Regards,
Mike
Hi Siim,
I just wanted to check in and see how things are going with this.
Regards,
Mike
Hi Siim,
I'm going to go ahead and mark this one as Resolved since I haven't heard back from you, but if you have further questions or concerns on this, if you respond, it will re-open the case and put it back in my queue and I'll be happy to help.
Regards,
Mike
Hi Siim,
I'm going to go ahead and mark this one as Resolved since I haven't heard back from you, but if you have further questions or concerns on this, if you respond, it will re-open the case and put it back in my queue and I'll be happy to help.
Regards,
Mike
Replies have been locked on this page!