Automatic filter for current month and year in Cognos Report Studio ver 10

Excited_to_learn picture Excited_to_learn · Jun 27, 2014 · Viewed 13.8k times · Source

I have a query item which filters records by a date column which is in format 'YYYYMM'. As of now I have hard coded the value [DateCol] = '201406' in Detail filters to get the current month and year records. But I want to dynamically have this value change. For next month it should filter records by '201407'. How do I achieve this? I tried this by dragging the [DateCol] in a Detail filters:

[DateCol] = extract(year, current_date) + extract(month, current_date)

But it returned an error:

UDA-SQL-0460 The operation "equal" is invalid for the following combination of data types: Character and Integer

Please guide

Answer

Alexey Baturin picture Alexey Baturin · Jun 27, 2014

Another formula

[DateCol] = cast(extract(year, current_date) * 100 + extract(month, current_date) as varchar(6))