How to constraint on calculation

could you please provide some sample file plz..