Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
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

7 Replies
swuehl
MVP
MVP

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
Employee
Employee

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 ...