Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

wrong total sum over column

Hello everybody,

i have an Pivot table with Prices of the actuale year "Preis", Prices of previous year "Preis_Vorjahr", the % change of the Price "relative Abweichung", the costs of the goods last year "Warenkosten VJ" and the calculated value with the Price cange "Warenkosten progn.".

The total sum of the calculated new Price column gives a difference of 0,02€.

Can somebody explain it or give me an example, how to do it right?

The column "Warenkosten progn." is wrong, the correct sum of the rows is  979,57 not 979,55

Thanks to all


1 Solution

Accepted Solutions
rbecher
MVP
MVP

Now I got it. The right aggregation expression is:

=sum(aggr(round(sum(Warenkosten_VJ)*(sum(Preis)/sum(Preis_Vorjahr)-1)/100+sum(Warenkosten_VJ),0.01),ID))

Astrato.io Head of R&D

View solution in original post

12 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Probably is due to rounding, you loose decimal places tat when summed lead to different totals

Not applicable
Author

thanks for the answer.

i have changed the decimals to 14 but the value is the same

0,00000000000000

84,33828000000000

0,00000000000000

161,45768484307600

0,00000000000000

0,00000000000000

168,67656000000000

565,10189695076600

0,00000000000000

alexandros17
Partner - Champion III
Partner - Champion III

Add your example if you can

rbecher
MVP
MVP

The aggregated sum should be: 979,58

What is the expression of this field?

Astrato.io Head of R&D
Not applicable
Author

the value should by 979,58 thats correct.

The Expression of the column is:

"Warenkosten VJ"*"relative Abweichung")/100+"Warenkosten VJ"

include the other expressions

"Warenkosten VJ"

({<Jahr={$(=getfieldselections(Jahr)-1)}>} Lieferantenstatistik.Umsatz)

"relative Abweichung"

(Sum({<Jahr={$(=getfieldselections(Jahr))}>} ItemPosition.Preis_BE)/Sum({<Jahr={$(=getfieldselections(Jahr)-1)}>} ItemPosition.Preis_BE))-1)

Not applicable
Author


Hi,

Try to use Num function for <relative Abweichung> and <main expression> as below:

Num(relative Abweichung exp, '#,##0.0##')

Num(("Warenkosten VJ" * "relative Abweichung")*100 + "Warenkosten VJ", '#,##0.0##')

rbecher
MVP
MVP

Could you attach an example please..

Astrato.io Head of R&D
Not applicable
Author

i have made a short example of my solution, because the data in the original are not for public use. In my example i get the same, wrong values.

rbecher
MVP
MVP

Now I got it. The right aggregation expression is:

=sum(aggr(round(sum(Warenkosten_VJ)*(sum(Preis)/sum(Preis_Vorjahr)-1)/100+sum(Warenkosten_VJ),0.01),ID))

Astrato.io Head of R&D