Dynamic current month selection

I found some interesting knowlegde on getting the current month dynamicly as a filter in Cognos. Here are the steps how:

Expand your time dimension and select any month member (Members are the one with the blue rectangle icon).

Right click on the member and select Properties, and you will see there a property called Member Unique Name. This is usually structured like this: [cube].[dimension].[hierarchy].[level]->:[PC].[@MEMBER].[Name]

Once you have that, copy it. Look at the structure – we’re interested in the last bit – how is a month MUN constructed.
For our example, we’ll suppose it is built like this:[Sales].[Time].[Time].[Month]->[Time].[2010].[201003] (That’s March 2010, yyyymm).
So, you create a data item like this:
#'[Sales].[Time].[Time].[Month]->[Time].[‘+ timestampMask($current_timestamp,’yyyy’)+’].[‘+timestampMask($current_timestamp,’yyyy’)+timestampMask($current_timestamp,’mm’)+’]’#

Which will dynamically translate (Today) to [Sales].[Time].[Time].[Month]->[Time].[2014].[201402]

Item was written by Nimrod Avissar on Cognoise.com

Working with dates in Cognos

In Cognos reports I use various dates. I use today, first day of this year, first day of last year and last day of last year.First and last day of last year is used in january. In february we switch to the current year.

I use the following expressions to fill these dates:

Today: current_date

First day of this year: _add_days(Current_date ; (_day_of_year(Current_date)*-1)+1 )

First day of last year (only used in january): _first_of_month(_add_years(current_date;-1))

Last day of last year (only used in january): _last_of_month(_add_months (current_date;-1))