Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

COUNT and then SUM the result in an expression

Hi,

How do I COUNT and then SUM the results of the COUNT on the same expression..

Something like SUM(COUNT(number))

Your soonest response will be highly appreciated, thanks.

Regards,

Mpho Musida

7 Replies
datanibbler
Champion
Champion

Hi Mpho,

from the information you have included, I'd say yes, exactly so 😉

hic
Former Employee
Former Employee

If you really want to make nested aggregation, you need to use Aggr(), and decide which aggregator to use in the middle step. E.g.

     Sum(Aggr(Count(ID), Customer))

You cannot just write Sum(Count( .. ))

HIC

Not applicable
Author

Exactly like you wrote it. Count will obviously count all the text values and numeric values within that field. Sum will then tell you how many there are in total.

Upload a sample document if there is a particular output you are trying to achieve and I will have a look at it for you

PS: Just realised who you are

Cheers,

Byron

manojkulkarni
Partner - Specialist II
Partner - Specialist II

Select Expression Total

Test1.jpg

Not applicable
Author

PS: Thanks

MK_QSL
MVP
MVP

To use more than one Aggr (i.e. Max, Min, SUM, COUNT, Avg etc.) you need to use AGGR function.

Max(AGGR(SUM(Sales),Customer))

This will give you Max Sales from all Customers...

Not applicable
Author

Thank you all