Former Member

# BEX Formula assistance required !

HI Viewers,

Could you please help me on this formual. how to to put in BEX syntax.

IF ( X # 0) THEN ( X- ABS ( Y)) / X ELSE ABS ( Y).

Appreciate your support on this !

Thanks

Surendra

Edited by: Surendra Kumar on Dec 7, 2011 1:57 PM

##### Add a comment
10|10000 characters needed characters exceeded

### Related questions

Former Member
Posted on Dec 07, 2011 at 01:18 PM

Hi,

You need to use Boolean Operators in your formula.Just create a formula , right click on it and go to Boolean Folder.You will find necessary operators there(like not equal,equal,not etc).Boolean syntax is like this: (Condition)(Result1)+Not(Condition)(Result2).This says if condition satisfied then do result1.Else do result 2.There is no else in BEx.That's why I used NOT(Condition) instead.By the way ABS function is under mathematical functions.Consequently, your formula will be like this:

(x not equal 0)(x-abs(y))/x + (x=0)abs(y)

These threads explain your requierement in details:

Dynamic field selection by variable input in bex report

Writing formula with boolean operators

Regards,

Sunny

Edited by: sunnybt on Dec 7, 2011 2:43 PM

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member
Posted on Dec 07, 2011 at 01:34 PM

Hi,

In Bex If condition will be like this.

If starts with ( ) and Then is * and Else is +.

As per your requirement IF ( X # 0) THEN ( X- ABS ( Y)) / X ELSE ABS ( Y).

In Bex you can write like this in formula ( (X # 0) * ( X- ABS ( Y)) / X + ABS ( Y) )

Thanks

Riyez

##### Add a comment
10|10000 characters needed characters exceeded
• Posted on Dec 07, 2011 at 01:55 PM

Hi,

Please try a condition like this:

(X <> 0 )* (X- Abs (Y))/X + (x == 0) * ABS(Y)

Note: Make use of boolean operators for equal and not eqaul to.

• means then and + means else in bex if else conditions.

Brackets are also imp.which system usually take care on its own.

Hope it helps.

Regards,

AL

Edited by: AL1112 on Dec 7, 2011 3:14 PM

##### Add a comment
10|10000 characters needed characters exceeded
• Posted on Dec 07, 2011 at 02:16 PM

Hi

Please use below formula for your requirement:

(X< >0)*((X-ABS(Y))/X)+ABS(Y)

Make use of boolean operator for not eqaul to (< >) and replace X and Y with whatever your variables (if any).

Regards,

RJ

Edited by: SHARM RAJ on Dec 7, 2011 3:17 PM

Edited by: SHARM RAJ on Dec 7, 2011 3:17 PM

##### Add a comment
10|10000 characters needed characters exceeded
• Posted on Dec 07, 2011 at 04:11 PM

Hi

Use following condition

(((X # 0)((X-ABS(Y))/X)) AND ((X = 0)(ABS(Y)))

Regards