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

How to get previous year last month in cognos relational model?

Started by callmenagendra, 03 Feb 2015 06:47:44 AM

Previous topic - Next topic

callmenagendra

How to get previous year last month in cognos relational model?

MFGF

Quote from: callmenagendra on 03 Feb 2015 06:47:44 AM
How to get previous year last month in cognos relational model?

Hi,

Last month as in the last month of the previous year (ie December 2014) or last month (ie January 2015) a year ago (ie January 2014)?

The answer is to code a filter based on current_date()

For example:

[your date item] between _first_of_month (_add_years(_add_months (current_date,-1),-1)) and _last_of_month (_add_years(_add_months (current_date,-1),-1))

This would return rows for January 2014

MF.
Meep!


peewan

Quote from: MFGF on 03 Feb 2015 07:04:06 AM
Hi,

Last month as in the last month of the previous year (ie December 2014) or last month (ie January 2015) a year ago (ie January 2014)?

The answer is to code a filter based on current_date()

For example:

[your date item] between _first_of_month (_add_years(_add_months (current_date,-1),-1)) and _last_of_month (_add_years(_add_months (current_date,-1),-1))

This would return rows for January 2014

MF.


How can I get 'Last month as in the last month of the previous year (ie December 2014)'?? Thank you

BigChris

[Date] between _maketimestamp(_add_year(current_date,-1),12,1) and _maketimestamp(_add_year(current_date,-1,12,31)