1
How can I perform calculations between subsets of a group by query in English? Follow example:
Consulta Linq
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. Then I would like a help to calculate via Linq or Lambda the values between each item of the account plan per month. Ie:
Total Month Revenue 1 - Month Deductions 1 - Month Costs 1 - Month Expenses 1
Thanks in advance.
Do you already get the table exactly as it is in your example? If so wouldn’t it just be creating a class to store the total of each month? I’ll create an answer based on that and you see if it meets.
– George Wurthmann