On Sat, Nov 19, 2022 at 4:24 AM Peter <[email protected]> wrote:

> Edit:
>
> I started with this query:
>
> SELECT date, account, other_accounts, position WHERE account ~
> "Assets:Cash:Checking"
>
> which outputs more or less a journal, but I'd like to summarize it per
> other_accounts.
>
> I also tried to use
>
> SELECT account, other_accounts, position WHERE account ~
> "Assets:Barvermögen:Giro:DKB" group by other_accounts
>
> But this yields the error
>
> > Received invalid data as query error.
>

I can't reproduce. Which version are you using? Might be related to unicode.


>
>
> *(As all transactions from checking to any other account do only have one
> posting, there should be no problems regarding other_accounts holding
> potentially multiple postings/accounts.)*
>

Another function that could be useful for this type of usage is an
"other_account_or_null" type of function, whereby if there are only two
postings (very common) returns the account of the other, and otherwise
None.  It's bound to be a little fragile though, because plugins in the
future may add more postings, e.g. for currency accounts and that would
break existing queries using that function. Don't know.



>
> Peter schrieb am Samstag, 19. November 2022 um 10:12:50 UTC+1:
>
>> I'd like to fetch the sum (per account) of the amount of money I sent
>> from my checking account to any account during the year. The goal is to
>> compute the average outflow per month to get a better understanding of the
>> cashflow.
>>
>> I tired:
>>
>> SELECT account, other_accounts, sum(units(position)) WHERE account ~
>> "Assets:Cash:Checking" group by account, other_accounts
>>
>> or
>>
>> SELECT account, other_accounts, units(sum(position)) WHERE account ~
>> "Assets:Cash:Checking" group by account, other_accounts
>>
>> and variations of that. Each query failed by telling me
>>
>> > TypeError: unhashable type: 'list'
>>
>> I guess, there's a problem calculating a hash or so, but I don't know.
>> Tried to search in this group, but I didn't find anything related that
>> helped (I'm pretty sure I used the wrong search term, tbh).
>>
>> How do I get the summarized outflow from the checking account to any
>> other account using bean-query?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/3dc2d327-eb0f-44f3-902e-a15a7b3de106n%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/3dc2d327-eb0f-44f3-902e-a15a7b3de106n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhP%3DL3ZJKsS%3DLTPft-gyQkA3FuxqVniAEsuz1HGA8QmtbA%40mail.gmail.com.

Reply via email to