COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Jaboy on 08 Aug 2010 02:54:26 AM

Title: Conditional Column
Post by: Jaboy on 08 Aug 2010 02:54:26 AM
Can anyone share ideas on how to create this, lets say the report runs on the 5th day of the month then "X" will be displayed on the 1st week or maybe run on the 11th day of the month then "X" will be display on the 1st and 2nd week from the report.

Sample:

| WK1 | WK2 | WK3 | WK4 |
|   X   |   X   |        |        |
report runs on the 11th day of the month, and so on...

TIA.  :)
Title: Re: Conditional Column
Post by: jackg_tor on 10 Aug 2010 01:39:34 PM
You don't really define what you mean by "first week" or "second week" but assuming it's just the first 7 days, regardless of which weekday you're on, a report expression like this works for the second week column:

if (_days_between (ReportDate(), _first_of_month (ReportDate())) < 7) then ('') else ('X')

If you do care about the day of the week then you'll need a more complicated expression involving the _day_of_week function.

For some reason, at least one of the columns must contain a query expression instead of a report expression.