COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: ajaju30 on 23 Sep 2014 07:32:23 AM

Title: Case statement for Data items with DMR functions
Post by: ajaju30 on 23 Sep 2014 07:32:23 AM
Hi,

I have two data items as Prev_period and Previous Year with definition as mentioned below.

Prev_Period : lastPeriods(2,[Savings (Analysis)].[Time (Arrival)].[TIME (ARRIVAL)].[MONTH]->?p_month?) - User selected month and its previous month

Prev_year : union(lastPeriods(1,[Fuel Savings (Analysis)].[Time (Arrival)].[TIME (ARRIVAL)].[MONTH]->?p_month?),lastPeriods(1,parallelPeriod([Savings (Analysis)].[Time (Arrival)].[TIME (ARRIVAL)].[MONTH],12,[Fuel Savings (Analysis)].[Time (Arrival)].[TIME (ARRIVAL)].[MONTH]->?p_month?))) - User selected month and same month for previous year.

I have a drop down from where user selects whether the graph as to be displayed for previous period or previous year.
I am trying to create a new data item with case statement as and use it in graph- case when(?p_comparison? = 'Previous Period')
then
([Prev_Period])
when(?p_comparison? = 'Previous Year')
then
([Prev_Year])
end

But, I am getting error as "   The query is not supported. The argument at position 2 of 'when' from the data item 'Data Item1' cannot be coerced into a 'value' expression.=== Please see http://www.ibm.com/search/csass/search?q=XQE-PLN-0093 for more information ===. "

Kindly suggest how can I implement the above scenario.

Thanks in advance!!

Aarti