Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist II
Specialist II

Rounding Issue

I am aware of Rounding Errors but can't figure out how to fix it.

Column 1

Sum({$<FISCAL_YEAR=,APP_DATE={">$(=Max({<ACT_AMT={'>0'}>}APP_DATE))"}, FCST_DATE = {"$(=date(max(FCST_DATE), 'MM-DD-YYYY'))"}>}FCST_AMT)

Column 2 uses a variable called $(vLTETC) and defined as: round(Sum({$<FISCAL_YEAR=,APP_DATE={">$(=Max({<ACT_AMT={'>0'}>}APP_DATE))"}, FCST_DATE = {"$(=date(max(FCST_DATE), 'MM-DD-YYYY'))"}>}FCST_AMT),1000 ) /1000

These numbers have tied out in the past using the round(xxx,1000 ) /1000. However, you can see that 847,326,771 should round to 847,327 NOT 847,324.

For the record, I have a text box that CORRECTLY displays $(vLTETC) as 847,327 which confuses me even more.

Any ideas?

2-3-2016 12-36-25 PM.jpg

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

What about using total mode = expression total?

View solution in original post

13 Replies
sunny_talwar
MVP
MVP

What do you see for this (without the division by 1000):

round(Sum({$<FISCAL_YEAR=,APP_DATE={">$(=Max({<ACT_AMT={'>0'}>}APP_DATE))"}, FCST_DATE = {"$(=date(max(FCST_DATE), 'MM-DD-YYYY'))"}>}FCST_AMT),1000)

swuehl
Champion III
Champion III

As far as I see, you sum a set of rounded values which is not the same as round a set of the original values.

If you want max. accurate numbers, your rounding should happen as last step.

cbaqir
Specialist II
Specialist II
Author

2-3-2016 12-49-56 PM.jpg

cbaqir
Specialist II
Specialist II
Author

How would I do that?

And why would the variable in the text box round correctly but not in the chart?

sunny_talwar
MVP
MVP

May try this:

Round(Sum(Aggr(Sum({$<FISCAL_YEAR=,APP_DATE={">$(=Max({<ACT_AMT={'>0'}>}APP_DATE))"}, FCST_DATE = {"$(=date(max(FCST_DATE), 'MM-DD-YYYY'))"}>}FCST_AMT), YourChartDimensions)),1000)

cbaqir
Specialist II
Specialist II
Author

2-3-2016 12-57-47 PM.jpg

cbaqir
Specialist II
Specialist II
Author

I switched from using the round(xxx,1000 ) /1000 to using round(xxx) /1000 and in Number using Fixed to 0 decimals. It looks right but I am concerned that it may cause other issues which is why we started using round(xxx,1000 ) /1000.

Thanks for the quick responses, guys.

sunny_talwar
MVP
MVP

I am out of options. I am sure Stefan will find an answer for you

swuehl
Champion III
Champion III

What's your total mode for this expression? Expression total or sum-of-rows?