Why calculating conditions are not working?