where do you want to use this expression? In script:
If(fieldA < fieldB,'delay','ontime') as Newfield,
In a chart expression, you can use
=if(fieldA < fieldB,...)
but only if fieldA and fieldB show a unique value per your dimensional context.
If not, use aggregation functions