Bex If – Then example

07 Mar Bex If – Then example

BradSimon Brad Simon

Need to do if – then logic in a Bex query.

The syntax is a little strange but it works.

You can make conditional calculations using Boolean operators An expression in the form
IF<Logic Expression> THEN <Expression1> ELSE <Expression2> can also be made using a formula in the form
<Logic Expression> * <Expression1> + NOT <Logic Expression> * <Expression2>

Example:

IF Actual Costs > Plan Costs THEN Plan Costs + Plan Deviation ELSE Actual Costs

can be written as the following formula:

(Actual Costs > Plan Costs)* (Plan Costs + Plan Deviation) + (NOT (Actual Costs > Plan Costs)* Actual Costs

or

(Actual Costs > Plan Costs)* (Plan Costs + Plan Deviation) + (Actual Costs <= Plan Costs) * Actual Costs

Brad Simon is a data architect and developer with over 18 years experience implementing business intelligence and development solutions across all versions of SAP including BW on HANA and HANA Enterprise.  Brad can be reached at brad.simon@phxend.com

Tags:
1Comment

Post A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become A Partner

If you have a strong SAP background and a
“Whatever it takes” attitude , submit your resume.