Reputation: 1
Cognos report studio filter from Feb data to last closed month.
I need to build a report that should show data from Feb to last closed month.
If I run the report in March, it should show the data only for Feb. If I run the report in Dec, it should show the data from Feb to Nov. If I run the report in Jan, it should show the data from Last Year Feb to last year Dec. If I run the report in Feb, it should show the data from Last Year Feb to current year Jan.
Is anyone can help?
#Cognos # CognosBI #CognosDeveloper.
Upvotes: 0
Views: 320
Reputation: 851
Create a filter expression of [Itemtobefiltered] between [StartDate] and [EndDate]
The [StartDate] query calculation should have an expression of:
if (extract(month,current_date)<=2)
then
(_first_of_month(_add_years(current_date,-1)))
else
(cast(cast(extract(year,current_date),varchar(4))+'-02-01',date))
The [EndDate] query calculation should have an expression of:
_last_of_month(current_date)
Upvotes: 1