Group location rows by customer id and select debt of first customer from each group:
var query = from r in generateData().AsEnumerable()
group r by r.Field<string>("CustomerLocation") into g
select new
{
CustomerLocation = g.Key,
SumSubTotal = g.Sum(r => r.Field<int>("SubTotal")),
OrderCount = g.Count(),
SumCustomerDebt =
g.GroupBy(r => r.Field<int>("CustomerID"))
.Sum(cg => cg.First().Field<int>("CustomerDebt"))
};
This produces your expected results:
{ CustomerLocation = Chichago, SumSubTotal = 80, OrderCount = 3, SumCustomerDebt = 150 } { CustomerLocation = Miami, SumSubTotal = 50, OrderCount = 1, SumCustomerDebt = 20 }