COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: alexandery on 04 Oct 2010 03:20:06 PM

Title: Query Calculation for a Boolean type Count IF
Post by: alexandery on 04 Oct 2010 03:20:06 PM
Hi,

I have two data items on a query, one with (1) dates and the other with (2) Y/N values. On my page I selected data item (1) to be on my list but want to display the aggregate count of ('Y') values as the subtotals. I have unlocked the list to insert a query calculation but cannot find the expression to display the count from another query.

Can somebody help me out with this predicament?   

Thanks in advance for the helping hand and the patience with my description...
Title: Re: Query Calculation for a Boolean type Count IF
Post by: MFGF on 05 Oct 2010 05:44:53 AM
Hi,

If they are in the same query, this should be fairly straightforward:

1) Add a Query Calculation with the expression  if([your Y/N item] = 'Y') then (1) else (0)
2) Add a second query calculation with the expression  total([your first query calculation] for [your Y/N item])

Regards,

MF.