If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Filter to display last 12 complete months

Started by D1234, 04 Jan 2018 12:16:45 PM

Previous topic - Next topic

D1234

Hello,

I need to create a filter which will automatically give me the information for the last 12 complete months. For example, since today is January 4, 2018, I need to exclude January thus far.

Could I accomplish this with something like:

_month_of_year ( [Date] ) between
  _month_of_year ( _add_days ( current_date, -X ) )
  and
  _month_of_year ( _add_days ( current_date, -X ) )

Thanks

Lynn

This might work for you:


[Date] between
   _first_of_month ( _add_months ( current_date, -12 ) )
   and
   _last_of_month ( _add_months ( current_date, -1 ) )

Invisi

And if your date dimension has a first day of month and last day of month column, you can use those in Lynn's suggestion to have a bit fewer functions.
Few can be done on Cognos | RTFM for those who ask basic questions...

D1234

Thanks,

I ended up getting it to work with this filter:

[Date] >_first_of_month (_add_months (current_date,-12))
and
[DateVisit
< _last_of_month (_add_months (current_date,-1))