cancel
Showing results for 
Search instead for 
Did you mean: 

IF Else condition in SAP BW BEx Query

Former Member
0 Kudos

Hi All,

Can anyone please brief me below logic.i am bit confused on below logic in sap bex query formula

((A==0)*1+0)*(B-C)

with warm regards,

Giri

Accepted Solutions (0)

Answers (2)

Answers (2)

Loed
Active Contributor
0 Kudos

Hi,

Antonio's explanation above is correct.

You can just use his formula.

(A==0) * (B-C)

But sometimes having multiple elements.

So what you can do is store first the B-C in a FORMULA.

TEST_FORMULA = B - C

Then apply it to your condition formula.

(A==0) * TEST_FORMULA

Regards,

Loed

Former Member
0 Kudos

Hi Giri,

a condition is 1 if it's true, otherwise 0. In your example:

if content of A = 0, the condition is true (equal 1) and the result will be (1*1+0)*(B-C) = B-C.

if content of A <> 0, the condition is false (equal 0) and the result will be (0*1+0)*(B-C) = 0.

You can have the same result with the following formula: (A==0) * (B-C).

In general, if-then-else is made in Bex in this way:

if A = x
 then B
elseif A = y
 then C
else D

in Bex

(A==x)*B + (A==y)*C + (A<>x * A<>y)*D

Best regards,

Antonio