How can I perform calculations between subitems of a group by query in linq? Here's an example:
Linq Query
var listPlanoDeContas = (from t in _planoDeContasRepository.GetAll()
orderby t.Month ascending
group t by t.DfpChartOfAccounts into dfpGroup
select dfpGroup).ToList();
To illustrate, this query returns something like:
Plano de Contas | Mês 1 | Mês 2 | Mês 3 | ...
Receitas Totais 10000,00 13000,00 8000,00
Deduções 878,00 1020,00 780,00
Custos 1345,00 1478,00 850,00
Despesas 3789,00 4342,00 1678,00
______________________________________________________________________
Saldo de Caixa ? ? ?
I need to find the cash balance . So I would like some help to calculate via Linq or Lambda the values between each item in the chart of accounts per month. That is:
Total Revenue of the Month 1 - Deductions of the Month 1 - Costs of the Month 1 - Expenses of the Month 1
Thank you in advance.