Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
dasaradh
Contributor III
Contributor III

aggr function

Hi

i have data like this

LOAD * INLINE [

    cust no, acc no, bal

    1, 1a, 15000

    2, 2a, 50000

    3, 3a, 20000

    4, 4a, 20000

    1, 1b, 12000

    2, 2b, 5000

    5, 5a, 60000

];

i want to count the no of customers who are having bal more than 50000, here i want to group on custno. i want to use in expression level

i have tried this exp but it is not working

=count(aggr(sum(bal)<=50000,[cust no]))

1 Solution

Accepted Solutions
sunny_talwar

This might also work:

=Sum(Aggr(Count({<[cust no] = {"=Sum(bal) < 50000"}>}[cust no]), [cust no]))

View solution in original post

12 Replies
maxgro
MVP
MVP

in a textbox, for less then 50000 (replace with >= for ...)

=sum(aggr(if(sum(bal)<50000,1,0), [cust no]))

sunny_talwar

This might also work:

=Sum(Aggr(Count({<[cust no] = {"=Sum(bal) < 50000"}>}[cust no]), [cust no]))

dasaradh
Contributor III
Contributor III
Author

hi

its working fine.

but i want to make it more globalize here is my exp

sum(aggr(if(sum(bal)>50000,1,0),customernbr))

here i want pass bal and 50000 as parameters in exp so that i want to build set analysis on this exp how to do that.

am i fallowing correct approach or not i am getting doubt please help in this

thanks in advance@

dasaradh
Contributor III
Contributor III
Author

thanks bro

sunny_talwar

No problem

I am glad it worked for you.

Best,

Sunny

sunny_talwar

Try this:

=Sum(Aggr(Count({<[cust no] = {"=Sum(bal) < $(vVar)"}>}[cust no]), [cust no]))

Where vVar is set using a inputbox object or slider object or any kind of variable input object

HTH

Best,

Sunny

dasaradh
Contributor III
Contributor III
Author

hi

i am also feeling the same

i want to make it more globalize here is my exp

sum(aggr(if(sum(bal)>50000,1,0),customernbr))

here i want pass bal and 50000 as parameters in exp so that i want to build set analysis on this exp how to do that.

am i fallowing correct approach or not i am getting doubt please help in this

thanks in advance@

dasaradh
Contributor III
Contributor III
Author

hi

here bal is also vary i mean some times it is BalnaceEur,BalanceDoller,LocalCurrunacy like that, that y i want to make it as variable

dasaradh
Contributor III
Contributor III
Author

and also we using it as expression not in text object