How to find average value of column Except last row from column

How to find average value of column Except last row from column

thanks
shaik

avgValue = (From row In DataTableName.AsEnumerable().Take(rowCount - 1)
Select Convert.ToDouble(row(“YourColumnName”))).Average()

Use this in assign activity… avgValue should be integer type

Hi @shaik.muktharvalli1

Try this

dt.AsEnumerable().Take(dt.Rows.Count - 1).Average(Function(row) If(IsNumeric(row("Column1")), CDbl(row("Column1")), 0))

Cheers!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.