How to get previous year last month in cognos relational model?
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.
Thank you very much
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
[Date] between _maketimestamp(_add_year(current_date,-1),12,1) and _maketimestamp(_add_year(current_date,-1,12,31)