Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count using Set analysis in chart expression

Hi Experts,

I want to get the count of distinct encounterid where the paid amount of that encounterid is less then or equal to zero.

I tried the following expressions i cant get the result

=Count({<EncounterID ={"=$(=Sum(PaidAmount)<=0)"}>}DISTINCT EncounterID)--Zero value is return

=Count({<EncounterID={"=(Sum(PaidAmount))<=0"}>} DISTINCT EncounterID)--Some wrong value is returned

i use the dimension as monthyear.

Can any one help me to come out of this problem

Thanks in Advance

Regards,

S.Amuthabharathi

Labels (1)
7 Replies
swuehl
Champion III
Champion III

I assume you want your set expression to consider your chart dimension, right? This will not work, please check

Evaluating "sets" in the context of a dimension

somenathroy
Creator III
Creator III

Try with Aggr function as below:

If(Aggr(Sum(PaidAmount),EncounterID) <= 0, count(DISTINCT EncounterID))

Regards,

Som

Not applicable
Author

=Count({<PaidAmount={"=$(=Sum(PaidAmount)<=0)"}>}DISTINCT EncounterID)

Clever_Anjos
Support
Support

Try

Count({<EncounterID={"=Sum(PaidAmount)<=0"}>} DISTINCT EncounterID)

Not applicable
Author

Hi

i tried this too but i can get  the answer only -

Not applicable
Author

I know this post has been open for a while - but I had the same issue and finally got it to work with the below expression. Perhaps it can help the next user

=COUNT(DISTINCT if(aggr(sum(PaidAmount),EncounterID) <= 0, EncounterID))

DutchHans
Contributor II
Contributor II

This construct also worked for me.

I had to compare a date field to my master calendar like so:

=COUNT(DISTINCT if(Einddatum >= MonthEnd(Caldatum), Number))

But is is super slow, so I need something else. Any idea's?

For every new problem someone probably found a solution already ...