COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: jrygiel on 10 Jan 2017 11:32:19 AM

Title: Current Year minus 1
Post by: jrygiel on 10 Jan 2017 11:32:19 AM
If Year data items is:  Cast((right ([Presentation].[Projects].[Launch Season],4) || '-01-01'), date)

and Current Year data item is: Cast((Substring((Cast(Current_Date, char(18))), 1, 4) || '-01-01'), date)

We had the following filter: [Year] <= ([Current Year] + 3 Year)

to show 2016, 2017 and 2018 but now that it's 2017 we are having challenges going back to 2016.

Can you help me with this filter to show only 2016, 2017 and 2018. 

Thank you!
Title: Re: Current Year minus 1
Post by: New_Guy on 10 Jan 2017 01:55:50 PM
Hi,
From what I understood, you have to show years last, current, next. Let me know if I am wrong.

For this you have to create 3 data items from current date to grab the 3 years and then try creating a filter with 'in' condition using the three data items you created. You might have to use #sq()#. Try around this suggestion and let me know. Meanwhile I will give it a try.
Good luck
New Guy
Title: Re: Current Year minus 1
Post by: Lynn on 11 Jan 2017 02:00:50 AM
Quote from: jrygiel on 10 Jan 2017 11:32:19 AM
If Year data items is:  Cast((right ([Presentation].[Projects].[Launch Season],4) || '-01-01'), date)

and Current Year data item is: Cast((Substring((Cast(Current_Date, char(18))), 1, 4) || '-01-01'), date)

We had the following filter: [Year] <= ([Current Year] + 3 Year)

to show 2016, 2017 and 2018 but now that it's 2017 we are having challenges going back to 2016.

Can you help me with this filter to show only 2016, 2017 and 2018. 

Thank you!

How about changing the filter to something like this:


[Year] between _add_years( [Current Year], -1) and _add_years( [Current Year], 1)


Title: Re: Current Year minus 1
Post by: jrygiel on 11 Jan 2017 01:12:23 PM
Lynn,

It worked!  Thanks so much.  Have a great day!

:) :) :) :) :)
Title: Re: Current Year minus 1
Post by: Lynn on 12 Jan 2017 06:41:49 AM
Quote from: jrygiel on 11 Jan 2017 01:12:23 PM
Lynn,

It worked!  Thanks so much.  Have a great day!

:) :) :) :) :)

Hooray!