COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: t0mato on 31 Mar 2021 09:13:45 AM

Title: COUNT WHERE ?
Post by: t0mato on 31 Mar 2021 09:13:45 AM
Hi,

In my database, we have applicants and a recruiting STEP they are in. Each candidate has an EMAIL_ADDRESS tied to them. How can I count the number of EMAIL_ADDRESS tied to a particular step?

My thoughts would be:

Count([EMAIL_ADDRESS] WHERE [STEP]='The step I want')

FOR doesn't seem to work in this instance either (in place of WHERE). Could someone help me with the syntax in this seemingly simple calculation?
Title: Re: COUNT WHERE ?
Post by: MFGF on 31 Mar 2021 09:53:53 AM
Quote from: t0mato on 31 Mar 2021 09:13:45 AM
Hi,

In my database, we have applicants and a recruiting STEP they are in. Each candidate has an EMAIL_ADDRESS tied to them. How can I count the number of EMAIL_ADDRESS tied to a particular step?

My thoughts would be:

Count([EMAIL_ADDRESS] WHERE [STEP]='The step I want')

FOR doesn't seem to work in this instance either (in place of WHERE). Could someone help me with the syntax in this seemingly simple calculation?

Hi,

If you wanted a count of addresses for each step, then the expression would be

count(distinct [EMAIL_ADDRESS] for [STEP])

Otherwise, if you wanted a count of email addresses for a particular step, then

if ([STEP] = 'The step I want')
then (count(distinct [EMAIL_ADDRESS] for [STEP]))
else (null)

Cheers!

MF.
Title: Re: COUNT WHERE ?
Post by: t0mato on 31 Mar 2021 10:27:13 AM
Excellent, thank you!