Ohh.. My appologies... You have to group by both prperties to access it, thn you can access it as k.key.Renta, k.key.Category.
I think you have to use LINQ rather than the extension.
var groups = from t in DataSet1.TotalRevenuwByMonth
where t.totalcategory.Equals(Helpers.TotalCategory.PNEWBUSINESS)
group t by t.totalcategory into g
select new { totalcategory= t.totalcategory,
productFamily=t.productFamily
sum1=g.sum(a=>a.field1),
sum2=g.sum(b=>b.field2)};
Cheers,
Gopakumar
| Please click “Mark as Answer” on the post(s) if it helps |
gopakumar.r
Participant
959 Points
193 Posts
Re: DataSet .Select and .GroupBy
Apr 26, 2012 01:28 PM|LINK
Ohh.. My appologies... You have to group by both prperties to access it, thn you can access it as k.key.Renta, k.key.Category.
I think you have to use LINQ rather than the extension.
var groups = from t in DataSet1.TotalRevenuwByMonth where t.totalcategory.Equals(Helpers.TotalCategory.PNEWBUSINESS) group t by t.totalcategory into g select new { totalcategory= t.totalcategory, productFamily=t.productFamily sum1=g.sum(a=>a.field1), sum2=g.sum(b=>b.field2)};Gopakumar
| Please click “Mark as Answer” on the post(s) if it helps |