COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: elroy on 23 May 2011 03:12:07 AM

Title: Conditional filter
Post by: elroy on 23 May 2011 03:12:07 AM
Hi all,
are there any options/possibilities to create a report with a conditional filter?
This filter should only be active when different conditions are true (e.g. only on the last of a month)?

Thanks and Regards,
elroy
Title: Re: Conditional filter
Post by: PRIT AMRIT on 23 May 2011 03:41:45 AM
QuoteThis filter should only be active when different conditions are true (e.g. only on the last of a month)?

If you want to filter your report on last of month, then you can put the below filter:

[DATE]=_last_of_month(current_date)

If you want to write a condition, then it should be something like below,

_last_of_month([DATE]) and [your condition 1]
or
[Condition 2]
or
[Condition 3]

Hope it helps?

Thanks
Title: Re: Conditional filter
Post by: elroy on 23 May 2011 06:35:35 AM
At first, thanks for your reply..
But unfortunately it is not the solution i am searching for.

It should work as follow:

There are two different filters and only one should work if a condition is true.
It has to be something like that:

If ([DATE]=_last_of_month(current_date))
Then (show me all of the last 8 weeks)
Else (show me all of this month)

Are there any other ideas?

Thanks and regards,
elroy

Title: Re: Conditional filter
Post by: Lynn on 23 May 2011 02:09:11 PM
Below logic checks if today is the last day of the month and filters data to include 8 weeks (56 days) if it is. Otherwise if today is any day other than the last of the month then filter for the current month.


(
  current_date = _last_of_month(current_date)
  and [DATA_DATE] >= _add_days(current_date, 56)
)
or
(
  current_date <> _last_of_month(current_date)
  and [DATA_DATE] between _first_of_month(current_date) and _last_of_month(current_date)
)

Title: Re: Conditional filter
Post by: elroy on 24 May 2011 09:26:43 AM
Yes, this is it.
A simple logic expression and it works.

Thank you!!!
Regards,
elroy