Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
robertocesp
Contributor II

Subtotals at Buttom are not correct

Hi,

I have enable the Subtotals at buttom checkpoint, but the totals are wrong.

You can see that the sums are incorrect. How can I fix it?

I have the same problem with the same table but showing percentages.

Please advise.

Tags (1)
1 Solution

Accepted Solutions

Re: Subtotals at Buttom are not correct

Try this:

Sum(Aggr(Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}>} DISTINCT AutoID), Type, YRMON))

View solution in original post

8 Replies
MVP & Luminary
MVP & Luminary

Re: Subtotals at Buttom are not correct

It will depend on your expression if a normal partial sum could return the right respectively your expected results. Quite probably will be an aggr-function needed for it - something like this one:

sum(aggr(YourUsedExpressions, YearMonth, MaybeFurtherDimensions))

- Marcus

robertocesp
Contributor II

Re: Subtotals at Buttom are not correct

I am using the following:

=Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}>} DISTINCT AutoID)

But I am not understanding these totals.

Re: Subtotals at Buttom are not correct

What are your chart dimensions?

robertocesp
Contributor II

Re: Subtotals at Buttom are not correct

Type and YRMON, I have 3 types so I need them as rows, and year-month as columns.

Re: Subtotals at Buttom are not correct

Try this:

Sum(Aggr(Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}>} DISTINCT AutoID), Type, YRMON))

View solution in original post

robertocesp
Contributor II

Re: Subtotals at Buttom are not correct

That worked for one of my charts, but for another chart I have a problem with my percentage chart:

I make the change to use something similar:

=Sum(Aggr(Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}>} DISTINCT AutoID), [EE Type], YRMON))
/
Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}, [EE Type]=>} TOTAL <YRMON> distinct AutoID)

But it should stay on 100% and it's more than that as you can see. How can I fix it?

Re: Subtotals at Buttom are not correct

Try this:

=Sum(Aggr(Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}>} DISTINCTAutoID), [EE Type], YRMON))
/ Sum(TOTAL<YRMON> Aggr(Count({$<AutoID = {"=Date#(YRMON, 'YYYY-MM') > MonthStart(Today(), -13)"}, [EE Type]=>}  distinct AutoID), [EE Type], YRMON))

robertocesp
Contributor II

Re: Subtotals at Buttom are not correct

That worked too!!!!

Thanks