COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: amoslade on 04 May 2017 07:49:01 AM

Title: Expression to count even if null
Post by: amoslade on 04 May 2017 07:49:01 AM
I have a graph report I am creating.  I am trying to count the number of work orders assigned to individual technicians.  We have some work orders unassigned and I want those to show on the graph as well.  Here is the count statement I am using and I am wondering how to change it so null values will be included.

count ([EVT_CODE] FOR [EVT_PERSON], [Location])

Thanks for any advice!
Title: Re: Expression to count even if null
Post by: Lynn on 04 May 2017 07:54:41 AM
Quote from: amoslade on 04 May 2017 07:49:01 AM
I have a graph report I am creating.  I am trying to count the number of work orders assigned to individual technicians.  We have some work orders unassigned and I want those to show on the graph as well.  Here is the count statement I am using and I am wondering how to change it so null values will be included.

count ([EVT_CODE] FOR [EVT_PERSON], [Location])

Thanks for any advice!

You can try using a coalesce function to replace the null value with text that can then be counted by the count function.

Quote
coalesce ( expression_list )

Returns the first non-null argument (or null if all arguments are null). Requires one or more arguments in "expression_list".


coalesce ( [EVT_PERSON], 'Unassigned' )

Title: Re: Expression to count even if null
Post by: amoslade on 04 May 2017 08:31:49 AM
I tried this with no change.