# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
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.

Tags (1)
1 Solution

Accepted Solutions
MVP

## Re: Subtotals at Buttom are not correct

Try this:

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

8 Replies
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

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.

MVP

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.

MVP

## Re: Subtotals at Buttom are not correct

Try this:

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

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?

MVP

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

Contributor II

## Re: Subtotals at Buttom are not correct

That worked too!!!!

Thanks