COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: vito36 on 04 Mar 2015 03:18:39 AM

Title: Filter Expression
Post by: vito36 on 04 Mar 2015 03:18:39 AM
Hi
Im currently trying to put the below in a filter expression
Any ideas
IF
(current_date=2015-02-23)
THEN


([del_note_date] BETWEEN 2015-02-01 AND 2015-02-23
)

ELSE NULL))
Title: Re: Filter Expression
Post by: MFGF on 04 Mar 2015 03:40:40 AM
Quote from: vito36 on 04 Mar 2015 03:18:39 AM
Hi
Im currently trying to put the below in a filter expression
Any ideas
IF
(current_date=2015-02-23)
THEN


([del_note_date] BETWEEN 2015-02-01 AND 2015-02-23
)

ELSE NULL))

How about:

current_date = 2015-02-23 AND [del_note_date] BETWEEN 2015-02-01 AND 2015-02-23

MF.
Title: Re: Filter Expression
Post by: vito36 on 05 Mar 2015 03:29:52 AM
Hi I need  to Add multiple cases to the statement

example:

when current_date = 2015-02-23 then [del_note_date] BETWEEN 2015-02-01 AND 2015-02-23

when current_date = 2015-03-24 then [del_note_date] BETWEEN 2015-03-01 AND 2015-02-24
Title: Re: Filter Expression
Post by: BigChris on 05 Mar 2015 04:18:10 AM
Ok, there looks like there are a couple of typos in your question, but reading between the lines it looks like you want something like:

[del_note_date] between _first_of_month(current_date) and current_date
Title: Re: Filter Expression
Post by: MFGF on 05 Mar 2015 07:42:25 AM
Quote from: vito36 on 05 Mar 2015 03:29:52 AM
Hi I need  to Add multiple cases to the statement

example:

when current_date = 2015-02-23 then [del_note_date] BETWEEN 2015-02-01 AND 2015-02-23

when current_date = 2015-03-24 then [del_note_date] BETWEEN 2015-03-01 AND 2015-02-24

How about:

(current_date = 2015-02-23 AND [del_note_date] BETWEEN 2015-02-01 AND 2015-02-23)
OR
(current_date = 2015-03-24 AND [del_note_date] BETWEEN 2015-03-01 AND 2015-03-24)
Title: Re: Filter Expression
Post by: BigChris on 05 Mar 2015 07:58:42 AM
Just as a by-the-by, the second clause in your filter won't ever evaluate to TRUE - the end date in your date range is before the start date...that was the typo I was specifically referring to earlier.
Title: Re: Filter Expression
Post by: MFGF on 05 Mar 2015 08:10:33 AM
Quote from: BigChris on 05 Mar 2015 07:58:42 AM
Just as a by-the-by, the second clause in your filter won't ever evaluate to TRUE - the end date in your date range is before the start date...that was the typo I was specifically referring to earlier.

Whoops! I just fixed that in my reply! Thanks Chris! :)
Title: Re: Filter Expression
Post by: BigChris on 05 Mar 2015 08:58:11 AM
You're welcome - it was in the original text from the vito36...just thought I'd point it out.