Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cseward1963
Contributor

count(distinct) on specific table

My application has many related tables.  Each table represents a certain type of billed time.  Below is a sample of data from 2 of the tables.  All the other tables have the same columns with the last column being the unique time type.  I want to count(distinct(studentid) for the "DirectConsult" table only.  I tried this if(sum(direct_consult)>0,count(distinct(studentid)),0) , but it didn't work.  The if statement returned the count of all unique studentids.   I just want the count of unique studentids in the table "DirectConsult".  I hope someone has a suggestion.  Thanks.

    

DirectConsult time table structure
school_yeartyeartmonthtmonthnameschooliddisciplineidtherapistidstudentiddirect_consult
2013-201420139September1081765750290051
2013-201420139September1081765751389012.5
2013-201420139September1081765751389080.25
2013-201420139September1081765751389091
2013-201420139September1081765751389680.5
Individual time table structure
school_yeartyeartmonthtmonthnameschooliddisciplineidtherapistidstudentidindividual
2013-201420139September1081765750290051
2013-201420139September1081765751389012.5
2013-201420139September1081765751389080.25
2013-201420139September1081765751389091
2013-201420139September1081765751390751.5
1 Solution

Accepted Solutions
mov
Esteemed Contributor III

Re: count(distinct) on specific table

Not quite clear how it looks in your data model...  try

count({<direct_consult={'*'}>} distinct studentid)

5 Replies
aarkay29
Valued Contributor

Re: count(distinct) on specific table

May be this

count(distinct Aggr (studentid,direct_consult))

cseward1963
Contributor

Re: count(distinct) on specific table

This did not work.

aarkay29
Valued Contributor

Re: count(distinct) on specific table

Try this

(count(Distinct {<direct_consult-={""}>} Aggr(studentid,therapistid,direct_consult)))

mov
Esteemed Contributor III

Re: count(distinct) on specific table

Not quite clear how it looks in your data model...  try

count({<direct_consult={'*'}>} distinct studentid)

cseward1963
Contributor

Re: count(distinct) on specific table

THANK YOU !!! this is working

Community Browser