Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
BrunPierre
Partner - Master
Partner - Master

Disparity in totals when dimensions are selected in list boxes

Hi Guys,

So I have an AGGR function in a table to count the number of Customer IDs distinctly. Also, as a dimension is Customer Type, but the individual selection of the Customer Type does not tally with the total in the table.

I am still trying to figure out why that is so and could use some help.

Thanks.

 

 

9 Replies
benvatvandata
Partner - Creator II
Partner - Creator II

Could you share your exact expression? Also any screenshots of the issue would be helpful too.

BrunPierre
Partner - Master
Partner - Master
Author

The expression is as follows;

SUM(AGGR(COUNT({$<Year={'$(vMaxYear)'}>}DISTINCT CustomerIDToCount),CustomerIDToCount))

Table.PNG

The above is the total in a table.

Manaul sum.PNG

 However, selecting from the customer type list box one after the other results in differences in the totals.

Hope this provides more clarity on my issues.

Thanks

 

 

 

Kushal_Chawda

I am not sure why you need aggr here. Can you not simple try without aggr? Just a inner count expression

BrunPierre
Partner - Master
Partner - Master
Author

The table below shows the difference using AGGR and simple count distinct;

peter_brown_1-1597724893104.png

 

 

Vegar
MVP
MVP

It looks to me as you have customer IDs that are associated with more than one customer type in your data. 

BrunPierre
Partner - Master
Partner - Master
Author

It appears so, how would you suggest  I work around it considering that every dimension selected distorts the distinct totals in the table? I'm considering disregarding any other dimension selection.

Please advise!

Brett_Bleess
Former Employee
Former Employee

@kush, @Vegar  Hey guys, I know you have been having issues with notifications, hopefully this one has what you need now.

Cheers,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Kushal_Chawda

@BrunPierre 

Would you be able to share the sample to look at?

Kushal_Chawda

Probably try using Dimensionality()

Assuming you have 3 dimensions in pivot table. If you have more then add more if conditions as described below. Basically simply when you see one dimension use aggr of that dimension and when you see two dimension use aggr of that two dimension and so on

if(Dimensionality()=1,

sum(aggr(COUNT({$<Year={'$(vMaxYear)'}>}DISTINCT CustomerIDToCount),Year)),

if(Dimensionality()=2,

sum(aggr(COUNT({$<Year={'$(vMaxYear)'}>}DISTINCT CustomerIDToCount),Year,Customer_Type)),

COUNT({$<Year={'$(vMaxYear)'}>}DISTINCT CustomerIDToCount)))