COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: TripJ on 24 Feb 2017 12:16:11 PM

Title: row counts on multiple columns
Post by: TripJ on 24 Feb 2017 12:16:11 PM
Apologies in advance, total newb to Cognos Analytics.  Moving to CA from 7.5 and just got a trial installed.  Data Analyst is trying to do a simple report that, in addition to other summary columns, they are trying to do counts of Yes / No values on a column.  i.e. how many rows have YES how many have NO.  We've gotten through creating the report using the data source but how exactly to manipulate the report for this is a struggle.  What is the proper/best approach?  Is there good documentation on CA reporting/dashboards available?  Any suggestion or assistance is appreciated.
Title: Re: row counts on multiple columns
Post by: AnalyticsWithJay on 24 Feb 2017 01:31:00 PM
Rows with 'Yes':

total
(
     CASE WHEN [YES_NO_COLUMN] = 'Yes'
       THEN 1
       ELSE 0
     END
)


The total() function has an optional 'for' statement, which allows you to aggregate against different column(s) if necessary.
Title: Re: row counts on multiple columns
Post by: TripJ on 24 Feb 2017 01:47:24 PM
Thanks for the suggestion, we'll dig into that!
Title: Re: row counts on multiple columns
Post by: TripJ on 27 Feb 2017 02:16:09 PM
The 'Total' above is doing exactly what is needed, except...  The rows totaled need to be unique on a column.  Any assistance is greatly appreciated!

total of 'Y' in column yes_no for unique values in column WHOSIT

It seems like the following had a chance of doing this but no...

for distinct [WHOSIT]
total
(
     CASE WHEN [YES_NO_COLUMN] = 'Yes'
       THEN 1
       ELSE 0
     END
)
Title: Re: row counts on multiple columns
Post by: DragonLady on 01 Mar 2017 11:13:33 AM
count(distinct  [whosit] for [yes_no_column] , [moredistinction])