• could you try putting NULLIF round the bit that's causing the divide by zero error?