If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Controle value /0

Started by erjorgea, 29 Oct 2018 08:07:45 AM

Previous topic - Next topic

erjorgea

Hi

I have an expression that rest the value of one year to another year:

if(([ANYO_SELECCIONADO] is null) or ([ANYO_SELECCIONADO]=0))
THEN ([ANYO_ANTERIOR])
else if (([ANYO_ANTERIOR] is null) or ([ANYO_ANTERIOR]=0))
then ([ANYO_SELECCIONADO])
else ([ANYO_SELECCIONADO]-[ANYO_ANTERIOR]) / abs([ANYO_SELECCIONADO])


The problem is that when one of the years has no value or 0, but the other year has a valid value, the expression return me the value /0.


I want to control this value.

Thhx

BigChris

Might be easier with a case statement:


case
  when [ANYO_SELECCIONADO] is missing then [ANYO_ANTERIOR]
  when [ANYO_SELECCIONADO] = 0 then [ANYO_ANTERIOR]
  when [ANYO_ANTERIOR] is missing then [ANYO_SELECCIONADO]
  when [ANYO_ANTERIOR] = 0 then [ANYO_SELECCIONADO]
  Else ([ANYO_SELECCIONADO]-[ANYO_ANTERIOR]) / abs([ANYO_SELECCIONADO])
END

erjorgea

Great, now works properly, thx for the support