IF statements in Cognoscenti Insight

Post Reply
Jwreford
Posts: 3
Joined: Wed Jan 29, 2014 1:14 pm
OLAP Product: Cognos insight
Version: Insight
Excel Version: 2013

IF statements in Cognoscenti Insight

Post by Jwreford »

Hi,

I have been trying to use an IF function in a calculation section but I keep getting a syntax error saying ; missing left parenthesis.

Can anybody help me solve this?
Thanks
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: IF statements in Cognoscenti Insight

Post by declanr »

If you post your code people will be able to tell you what is wrong with it.
Declan Rodger
kaazimraza
Posts: 95
Joined: Mon Jun 25, 2012 6:58 am
OLAP Product: TM1, SSAS, Power BI
Version: 10.2.2
Excel Version: 2016

Re: IF statements in Cognoscenti Insight

Post by kaazimraza »

Jwreford wrote:Hi,

I have been trying to use an IF function in a calculation section but I keep getting a syntax error saying ; missing left parenthesis.

Can anybody help me solve this?
Thanks
Can you please post the code you're trying to get working?
Thanks,

Kaz
Jwreford
Posts: 3
Joined: Wed Jan 29, 2014 1:14 pm
OLAP Product: Cognos insight
Version: Insight
Excel Version: 2013

Re: IF statements in Cognoscenti Insight

Post by Jwreford »

Hi,

Sorry it would not let me post earlier, here is the code,
if(['ABS ERROR']=0,1,if(&(['ABS ERROR']>0,['FORECAST']=0,(1-['ABS ERROR']/['FORECAST']))

Thanks,

Joe
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: IF statements in Cognoscenti Insight

Post by declanr »

Jwreford wrote:Hi,

Sorry it would not let me post earlier, here is the code,
if(['ABS ERROR']=0,1,if(&(['ABS ERROR']>0,['FORECAST']=0,(1-['ABS ERROR']/['FORECAST']))

Thanks,

Joe
Try:

Code: Select all

['Destination']=N: If ( ['ABS ERROR'] =0, 1, If ( ( ['ABS ERROR'] > 0 ) & ( ['Forecast'] =0 ), 1- ( ['ABS ERROR'] \ ['FORECAST'] ), 0 ) );
You need to fill the 'Destination' part with whatever the destination measure is and the final 0 is just a guess on what you will want the result of the ELSE to be.
Declan Rodger
Jwreford
Posts: 3
Joined: Wed Jan 29, 2014 1:14 pm
OLAP Product: Cognos insight
Version: Insight
Excel Version: 2013

Re: IF statements in Cognoscenti Insight

Post by Jwreford »

Hi Declan,

Thanks for the above to look like this
['IM ACC DATA Measures':'ACCURACY %']=N:If;(['ABS ERROR']=0,1,If((['ABS ERROR']>0)&(['Forecast']=0),0,1-(['ABS ERROR']\['FORECAST']));

But I get the message =N:if; missing semicolon

Thanks,

Joe
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: IF statements in Cognoscenti Insight

Post by declanr »

Jwreford wrote:Hi Declan,

Thanks for the above to look like this
['IM ACC DATA Measures':'ACCURACY %']=N:If;(['ABS ERROR']=0,1,If((['ABS ERROR']>0)&(['Forecast']=0),0,1-(['ABS ERROR']\['FORECAST']));

But I get the message =N:if; missing semicolon

Thanks,

Joe
Not sure where you gained the extra semicolon from but you need to take it out. I also missed a bracket from the end of the code i provided.

Code: Select all

['IM ACC DATA Measures':'ACCURACY %']=N:If(['ABS ERROR']=0,1,If((['ABS ERROR']>0)&(['Forecast']=0),0,1-(['ABS ERROR']\['FORECAST'])));
Declan Rodger
Post Reply