Calculate avarege from data table

Hi guys,

Lets say I have this info in a datatable:

image

I need a summarized table like this one calculating the average value of each column

image

Any ideas?

have a look here:

And also:

Hi,

If you need to calculate each average grouping by product_name, the following will help you.

dt.AsEnumerable.GroupBy(Function(r) r("Product_name").ToString).Select(Function(g) dt.Clone.LoadDataRow({g.Key,g.First().Item("Week"),g.Average(Function(r) Cdbl(r("CA1"))),g.Average(Function(r) Cdbl(r("CA2"))),g.Average(Function(r) Cdbl(r("CA3")))},False)).CopyToDataTable()

Sample20230823-1L.zip (8.4 KB)

Regards,

Hey Here is the output I got
image

Avg_Name.xaml (10.1 KB)
Here is the xaml u can refer it

Happy Automation!

2 Likes

Hi,

I use your idea to build a solution.

Many thanks, I’ll mark yours as solution

I’m glad my idea was helpful to you! Thank you for considering it as a solution!

Happy Automation!

2 Likes

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