aaa waa

aaa waa

  • NA
  • 1
  • 0

aggregating few values in a datatable

May 29 2008 6:59 PM

hi,

i am new to programming and C# in general and i have to solve this example.i have a datatable on which i want to perform grouping and aggregation. i have detailed the steps below can someone please guide as to whats the best way to do this:-

the datatable contains, date ,num1,num2,num3(for ex), i need to aggregate this data by date in the following fashion

step 1 sort date by date asc
step2 add up all numbers and assign todays date and enter in array or..
step 3 pick the 2nd date and assign total minus 2nd date value to corresponding measure
step 4 

iteratively calulate the numbers for all the remaining dates in the array or.. Using this formula, a[i]value=a[i-1]-a[i]

 

pls take a look at the input and ouput i expect

INPUT DATA

date num1
3-Oct-08 100
7-Nov-08 200
20-Aug-09 300
20-Apr-10 400

 

output DATA

date num1 adjusted
Today 1000
3-Oct-08 900
7-Nov-08 700
20-Aug-09 400
20-Apr-10 0