Forum Discussion
atasovski
Jul 30, 2023Copper Contributor
Calculate the sum of turnover on client account by date of loan
Hi all, Can someone please help, I'm working on a rather big table in PowerQuery(cca 8.000.000 rows) I have a table with 4 columns Client ID LoanDate TurnoverAmount Turnover...
OliverScheurich
Jul 31, 2023Gold Contributor
Does the attached query return the intended result for the small sample table?
atasovski
Jul 31, 2023Copper Contributor
OliverScheurich it worked perfect but with small number of clients. When I turn off the filter on clients so I can see all clients in the file I got this message
- SergeiBaklanJul 31, 2023Diamond Contributor
As variant
let getTurnover = Table.Group( Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content], {"Client ID", "LoanDate"}, { {"Turnover", each [ tbl = _, loanDate = tbl{0}[LoanDate], filter = Table.SelectRows( tbl, (q) => q[TurnoverDate] <= loanDate and q[TurnoverDate] >= Date.AddDays(loanDate, -30)), t = List.Sum( filter[TurnoverAmount] ) ][t], Currency.Type } } ) in getTurnover- atasovskiJul 31, 2023Copper ContributorI get this error
Expression.Error: The column 'ClientID' of the table wasn't found.
Details:
ClientID- SergeiBaklanJul 31, 2023Diamond Contributor
In the sample it was "Client ID", not "ClientID"
- OliverScheurichJul 31, 2023Gold Contributor
Does the attached query return the intended result?