COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Manu0521 on 02 May 2014 10:45:58 AM

Title: Show different member based on IF condition in data item
Post by: Manu0521 on 02 May 2014 10:45:58 AM

Hi,
Can I assign a member value in my if then else expression.

I am trying to assign a member based on the condition .

I want to check if the current month is 12 then show a member named YearEndOffer or Offer member

IF(extract(month,CURRENT_DATE)=12)
THEN ([YearEndOffer])
ELSE
([OFFER])

this doesnt give error, but I could nt see any of the columns either Offer or Year End Offer in the report based on the condition.

Thanks,
Title: Re: Show different member based on IF condition in data item
Post by: Manu0521 on 02 May 2014 03:13:57 PM
Expression used:
if(extract(month,current_date)=12)
Then ([year end offer])
Else
([Offer])


Error:
XQE-DAT-0005
Cannot convert the double value '3.224556909660006E9' to data type integer.


Title: Re: Show different member based on IF condition in data item
Post by: bdbits on 05 May 2014 05:20:59 PM
If this is in a calculated data item, it is going to evaluate to whatever value is stored in [year end offer] or [offer]. It is not returning a member set.

What is it you want to accomplish? Where are you expecting to "see" this member set?
Title: Re: Show different member based on IF condition in data item
Post by: Manu0521 on 06 May 2014 07:31:54 AM
It is a normal member, I wanted to show different members based on my condition on a column.

If I give
if(5<7) then
([member1])
Else
([member2])
it selects the member.but if i give 

if(extract(month,current_date)<7) then
([member1])
Else
([member2])

then it doesnt select any member and doesnt give any error but my column doesnt show any of the value.

It behaves odd and Its a Tm1 source cube and i have created a ticket with IBM also.

if anyone has any suggestions please let me know.

Thanks,