Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count Total Problem

Hi,

I have to tables. Dimension is from one table, Expression ("count(field)") from second table (no, synthetic keys etc., just simple linked to tables by "orderid").
Unfortunately the totals aren't correct. Someone and idea what the reason could be? Thanks for your help.

error loading image

Regards
Aloah

7 Replies
Not applicable
Author

found the problem -> duplicate entries.

Not applicable
Author

Hi *,

I have a quite simple question (I guess).

I have eg. 100 orders. Some of the orders have a complaint type. Some order have two types.
If I create a table chart with complaint type as dimension and count (order) as expression, the total sum doesn't show the the correct numbers (each order is counted only once).

Someone an idea how to prevent this?
Thanks

Aloah

johnw
Champion III
Champion III

Perhaps change the Total Mode to Sum of Rows instead of Expression Total?

Not applicable
Author

Hi,

thanks for your answer. Uh I'm sorry I wrote table chart. Chart needs to be a pivot table and changing total mode is unfortunately not possible in pivot chart. I tried with aggr (someone in the forum had a similar problem), but in this case I don't get all values.

Aloah

johnw
Champion III
Champion III

If you're trying to simulate the sum of rows in a pivot table, it can be done like this:

sum(aggr(your expression here,your dimensions here))

Is that what you did? Is it not working? You may need to post an example.

Not applicable
Author

Hi John,

I tried count(aggr(OrderArt,Type))

Please find example attached. Thanks

johnw
Champion III
Champion III

I think you were overthinking what I gave you, trying to figure out how to modify it to make it work for your example, such as thinking you should replace the sum() with count() since you're counting. But it's simpler than that. All you need to do is plug your data in where indicated.

Your expression is this:

count(OrderArt)

Your dimension is this:

Type

Plugging those into what I gave you, you get this:

sum(aggr(count(OrderArt),Type))

And it mostly works. It appears that aggr() automatically excludes null column values, though, as the chart no longer includes the null type. Not sure if that's what you want or not, and I'm not sure how to fix it if you want the null type in the chart.