 Former Member

# If Else Condition in Query

Hi,

I am trying to use the following condition in my Query:

If Planned Hours = 0 ; Over Time = 0

Else OverTime = Actual Hours - Planned Hours.

Please advice on how can I acheive this using the formula in Query.

Thanks

Deepthi

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on May 26, 2009 at 02:35 AM

Hi Again,

You can create a formula for over time as below

Lets say the names of Planned hours - Ph, Over time - Ot, Actual Hours - Ah

Ot formula definition is

(Ph==0)0 + (Ph>0)(Ah-Ph).

And on this formula you can then define exception aggregation in the aggregation tab.

Exeption aggregation 'SUM' and reference characteristic ' 0CALDAY '.

Hope it helps,

Best regards,

Sunmit.

10|10000 characters needed characters exceeded
• Hi

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>

In ur case,

(Planned hour == 0) * 0 + NOT (Planned hour == 0) * (Actual Hours - Planned Hours).

• Former Member
Posted on May 26, 2009 at 07:18 AM

HI,

Try this way....In The formula for Over time....

(Planned Hours=0)*0 + (Actual Hours - Planned Hours)

Thanks