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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kris_vliegen
Partner - Creator III
Partner - Creator III

Wrong Total in pivot-table

Hi All,

I've created a pivot-table

pivot-table.JPG.jpg

As you can see is the total for 'Totaal 2013' and 'Contant 2013' wrong and should be 1.222.861 and 467.162

I use this expression:

=if(sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}Totaal_Liter) > 0,
sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}Totaal_Liter) ,
sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}CapLiter))

And for Station-type and store set on 'Show Parttial sums'


Why is he counting the wrong numbers?


Regards,

Kris

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I think you'll have to wrap your expression in another sum:


=sum({ $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >} aggr(

if(sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}Totaal_Liter) > 0,
sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}Totaal_Liter) ,
sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}CapLiter)),

Dim1, Dim2, ... , DimN))


Replace Dim1, Dim2, ... , DimN with the dimensions of your pivot table


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I think you'll have to wrap your expression in another sum:


=sum({ $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >} aggr(

if(sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}Totaal_Liter) > 0,
sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}Totaal_Liter) ,
sum( { $ < Datum1 = {'$(vMaxDate)' }, CalYear =, CalQuarter= , CalMonth=, CalDay= >}CapLiter)),

Dim1, Dim2, ... , DimN))


Replace Dim1, Dim2, ... , DimN with the dimensions of your pivot table


talk is cheap, supply exceeds demand
kris_vliegen
Partner - Creator III
Partner - Creator III
Author

Thanks, this seems to work!

Regards,

Kris