
Re: Partial sum of rounding
Ajay Krishnan Prabhakaran Mar 12, 2014 4:45 PM (in response to Simon Brulotte)I dont quite understand the issue. The subtotal is rounded off from 360381431,61 to 360 381 432
since the decimal place is 61 (>50) its rounded.
if num is 1.5 will be rounded to 2
if 1.8 will be 2
if 1.4 will be 1.
Can you explain a little more or am I missing something?
Note: if you just wanna drop the decimal part without rounding you can try floor().

Re: Partial sum of rounding
Simon Brulotte Mar 13, 2014 8:50 AM (in response to Ajay Krishnan Prabhakaran)Look at the rounded numbers:
58 668 858 + 302 752 512  1 039 939 = 360 381 431 NOT 360 381 432
Sorry for the long digits, I just gave you the precises numbers.
So the partial sum is still using the unrounded numbers. It's driving me crazy.

Re: Partial sum of rounding
Ajay Krishnan Prabhakaran Mar 13, 2014 11:20 AM (in response to Simon Brulotte)I see what you are getting to but qlikview doesn't add the rounded off numbers. It adds the actual numbers and rounds off the result.
But as you mentioned it is misleading. This is interesting..



Re: Partial sum of rounding
Ashwani Kumar Mar 13, 2014 9:15 AM (in response to Simon Brulotte)Which qv version you are using.
because what i know is that the qv automatically do the same thing as Ajay wrote ie. it auto convert the last digits to the above value .
This happens when you have the long decimal digits.

Re: Partial sum of rounding
Ashwani Kumar Mar 13, 2014 9:16 AM (in response to Simon Brulotte)and sometimes lowers the value ,as per the last digit (ie below 4)

Re: Partial sum of rounding
Simon Brulotte Mar 13, 2014 11:59 AM (in response to Ashwani Kumar)So rounding tlike this worked:
(sum({$<[%CLE_Type_Transaction_ID] = {'EB', 'EA'}, [Numéro du type d'écriture] = {'FERM'} >}round([Montant cumulé aad])* %CR003M))

Re: Partial sum of rounding
Simon Brulotte Mar 18, 2014 1:47 PM (in response to Simon Brulotte)SO I am taking out the correct answer that I had put to my own self...
hehe.
This is horrendous and skews the results since obviously every single line behind the code is rounded, creating havoc in my results.
So I am back to complaining that the partial sum doesn't get that the results are rounded, and takes the unrounded values to show a rounded sum.
I'm using QV 11 SR2

Re: Re: Partial sum of rounding
Jeremiah Kurpat Mar 18, 2014 2:25 PM (in response to Simon Brulotte)You'll have to create two sums, one for regular values and another for your partial sums. I've attached an example qvw. I used a formula like:
if(dimensionality() =2, round(sum(Value)), sum(aggr(round(sum(Value)), Type, Product)))
You should be able to accommodate this formula to your fields and calculations. The important parts are dimensionality() to distinguish between the regular values and your partial sums (the 2 may change depending on how much aggregation you are doing) and sum(aggr()) to sum the required rounded values (the fields listed will be dependent on your data).
EDIT: You may actually be able to get away with just:
sum(aggr(round(sum(Value)), Type, Product))
Hope this helps!

Rounding.qvw 154.8 K

Re: Partial sum of rounding
Simon Brulotte Mar 18, 2014 2:27 PM (in response to Jeremiah Kurpat)Well that definitly seems to work in your file.
You have no idea how much coding time this will require though for me. :*(

Re: Partial sum of rounding
Jeremiah Kurpat Mar 18, 2014 2:28 PM (in response to Simon Brulotte)I don't know if you saw my edit, but you may be able to get away with just:
sum(aggr(round(sum(Value)), Type, Product))
This should reduce the formula a bit.

Re: Partial sum of rounding
Simon Brulotte Mar 18, 2014 2:32 PM (in response to Jeremiah Kurpat)Yeah, did, I tested in your file and it worked in deed.
But I have at least 40 some expressions to change with each 3 to 4 dimensions, and that is without taking into account a sandbox that has 20 some dimensions and 20 some expressions. Using AGGR requires that I explicitly state which dimension I am agrregating for right?

Re: Partial sum of rounding
Jeremiah Kurpat Mar 18, 2014 2:42 PM (in response to Simon Brulotte)Unfortunately yes, but if some charts use the same dimensions, you could create a variable vAggr with a value:
Type, Product
Then for your expression your could do:
sum(aggr(round(sum(Value)), $(vAggr)))
Other than that, you could leave it the way it is and just let the user know that the rounding takes place after the summing (which therefore the partial sum is not always the sum of the rows above). In all honesty, this probably gives more of an accurate sum.
Hope this helps!






