If..Then...Else in Bex Queries

Question: Hi All,

I have a problem in creating a formula. I need to use "If...Then...Else" logic. Example

If Field A = 1 then Field B = 0 else Field B = Field C as a percentage of Field D.

Can anyone offer any advice on how this can be done as a formula in BEx Analyser query definitions.


thanks in advance for your help.


David

Answer:
If Field A = 1 then Field B = 0 else Field B = Field C as a percentage of Field D.


I think this would work:

IF(A=1, 0, C%D)

Answer:
This is it:

(A == 1 )*(C % D)

It means:
if A=1, then (A==1) will be 1, and then the whole formula will get the value of (C % D)
if A<>1, then (A==1) will be 0, and then the whole formula will get the value 0
_________________
Leandro,

Tuly Idiots Shadow Supporter

Answer:
Hi Guys,

Thanks for the help. With a little modification and using the Boolean operators I was able to determine the solution as follows;

(Field A == 1)*(Field B = 0) + (Not (Field A ==1)*( Field C % Field D)


Thanks for the prompt responses.


Regards,

David
Copyright ?2007 - 2008 www.jt77.com