Your expression should be:
count(if (DAY_ACT_EC.FULL_DATE-DAY_ECSCHED.FULL_DATE < 4, SERIAL_NUMBER))
But you should avoid using if-statements in your expressions, since they can degrade the performance. Instead, try to use set analysis like this:
to do so, you must precalculate the DaysScheduled in the script and have the values in a field.