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

count and set analysis

Hello,

I'm struggling with one set analysis expression. I've got a chart object like this:

AccounIDAccountName
Expression1Expression2 (Y or N)
1111AAAA10N
2222BBBB20Y
3333CCCC30Y

where

Expression1:

=count({$<CASHJOURNALTYPE.paymenttype={1},CashCalDate={">=$(=date(now()-1,'YYYY-MM-DD'))"}>}CASHJOURNAL.linkcashjournalid)

Expression2:

=if(count({$<CASHJOURNALTYPE.paymenttype={1},CashCalDate={">=$(=date(now()-1,'YYYY-MM-DD'))"}>}CASHJOURNAL.linkcashjournalid)>=20,'Y','N')

Both expression works fine. But I want to get a count of AccountID's where Expression2 = 'Y' in separate text object. In my example expected result is 2. How the set analysis expression should look like?

Any idea how to get it done would be highly appriciated. Thanks in advance!

~Sergejs

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I would try with something like this:

=sum( aggr(

if(count({$<CASHJOURNALTYPE.paymenttype={1},CashCalDate={">=$(=date(now()-1,'YYYY-MM-DD'))"}>}CASHJOURNAL.linkcashjournalid)>=20,1,0),

AccountID))

I think you don't need to change your set expression, but aggregate the results of the expression grouped by AccountID.

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

I would try with something like this:

=sum( aggr(

if(count({$<CASHJOURNALTYPE.paymenttype={1},CashCalDate={">=$(=date(now()-1,'YYYY-MM-DD'))"}>}CASHJOURNAL.linkcashjournalid)>=20,1,0),

AccountID))

I think you don't need to change your set expression, but aggregate the results of the expression grouped by AccountID.

Hope this helps,

Stefan

zekazak
Creator
Creator
Author

Hi Stefan,

Yep, Thanks. It works. You've saved my life.

Best Regards,

~Sergejs