Need help with formula

I am trying to calculate area under the curve (auc). For some reason my formula doesn’t work. I don’t understand why. I would be grateful for your help.

Here’s the correct formula:


First of all, instead of ip.x1i, ip.x2i etc you should use thisRow.x1i or just x1i — because if you explicitly specify table name, it returns a list of values from all rows, not from current row only.

Secondly, you had a problem with division — you need to divide the sum of all products by 2, not only the last product. Each trapezoid’s area formula is width * (height1 + height2) / 2