Calculate amount can handle deleted value for result udf, fix bug with adding numeric udf.