Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP & Luminary
MVP & Luminary

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))

Vizlib Head of R&D

View solution in original post

12 Replies
Highlighted

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

Not applicable

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

Highlighted

Add your example if you can

Highlighted
MVP & Luminary
MVP & Luminary

The aggregated sum should be: 979,58

What is the expression of this field?

Vizlib Head of R&D
Highlighted
Not applicable

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)

Highlighted
Not applicable


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##')

Highlighted
MVP & Luminary
MVP & Luminary

Could you attach an example please..

Vizlib Head of R&D
Highlighted
Not applicable

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.

Highlighted
MVP & Luminary
MVP & Luminary

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))

Vizlib Head of R&D

View solution in original post