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: 
Not applicable

Count (Sub Total)

Is it possible to do a count(sub total)?

For instance,

ID1 ID2 Count

a 1 4

a 2 4

a 3 4

a 4 4

b 5 3

b 6 3

b 7 3

For the IDs, I want to to a subtotal of how many ID2 are in ID1.

1 Solution

Accepted Solutions
Not applicable
Author

In a chart expression. I actually just figured it out. Count(DISTINCT TOTAL <ID1> ID2) gave the what I needed. Thanks for the reply.

View solution in original post

2 Replies
Not applicable
Author

Are you looking to do it in your load script or as an expression in your app?

In the load script, I would probably use a sub-query. You would need to group by ID1 and do a Count of ID2. It doesn't really work to do that out of an Inline, but it should work on a Database or Table File.

To do it in an expression, I would use:

Aggr(NODISTINCT Count(DISTINCT ID2), ID1)


I've attached a sample.

Not applicable
Author

In a chart expression. I actually just figured it out. Count(DISTINCT TOTAL <ID1> ID2) gave the what I needed. Thanks for the reply.