Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cseward1963
Creator
Creator

count (distinct if . . . . . .

Hello All.

This works for me:

count(distinct if (DC>0,studentid))    - count students who received direct or consult services

and this works too:

count(  distinct if ( (Ref>0) ,studentid  ))  - count students who were screened or evaluated

BUT, this does NOT work:


count(  distinct if ( (Ref>0) and (DC>0) ,studentid  ))  -  count students who were screened or evaluated and who received direct or consult services;  this expression always returns a ZERO 


7 Replies
Anonymous
Not applicable

count({<ref={‘>0’},DC={‘>0’} } studentid)


or



count(Distinct{<ref={‘>0’},DC={‘>0’} } studentid)

martinpohl
Partner - Master
Partner - Master

use set analysis instead

Count ({<ref={">0"},DC={">0"}>} distinct studentid)

zebhashmi
Specialist
Specialist

if I am recalling right. there is a Function AND() you would have to use.

Let me see if I can provide you a detail.

zebhashmi
Specialist
Specialist

count(  distinct if ( AND(Ref>0,DC>0) ,studentid  ))

or

count(  distinct if (Ref>0 and DC>0 ,studentid  ))

and May be this

count(  aggr(distinct if (Ref>0 and DC>0 ,studentid  )))

cseward1963
Creator
Creator
Author

Martin Pohl, thank you for your reply, your expression:

Count ({<ref={">0"},DC={">0"}>} distinct studentid)

is acceptable to the Editor, but it returns the same value as

count(distinct if (DC>0,studentid))

devarasu07
Master II
Master II

Hi,

you can try below method,

Method 1: by creating cal. measure using set analysis

Count(distinct {$<Ref={">0"},DC={">0"}>} studentid

Method 2: by creating cal. measure using if condition

if(Ref>0 and DC>0, count(distinct studentid) )

Thanks,Deva

luismadriz
Specialist
Specialist

Hi,

Your expression should have worked, something else is happening.Yes, set analysis is better, but your expression should've worked,

Please share more information such as app, data, screenshots?

Cheers,

Luis