New issue 160: Is it possible to combine the "balance" column with aggregate 
functions?
https://bitbucket.org/blais/beancount/issues/160/is-it-possible-to-combine-the-balance

Jonatan Kornholt:

I have tried to create a beancount-query to show the increase in net worth per 
month and the total net worth in one query. But it doesn't seem like I can 
combine the sum function with the balance function:

SELECT year(date) as year, month, sum(value(position)) as NetIncrease, balance 
as NetWorth
WHERE account ~ 'Assets|Liabilities'
AND not account ~ 'Pension'
GROUP BY year, month
ORDER by year, month

This returns:

> "All non-aggregates must be covered by GROUP-BY clause in aggregate query."

If I then add:

GROUP BY year, month, NetWorth

Then the Fava website returns:

> "The server encountered an internal error and was unable to complete your 
> request. Either the server is overloaded or there is an error in the 
> application."

I first posted this issue in bean-count-sql-queries and aumayr suggested I 
posted here instead. He also supplied the following stacktrace:

```
#!python

Traceback (most recent call last):
  File 
"/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/cmd.py",
 line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'QueryShell' object has no attribute 'do_SELECT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/Users/dominik/Projects/beancount/beancount/src/python/beancount/query/shell.py",
 line 258, in run_parser
    self.dispatch(statement)
  File 
"/Users/dominik/Projects/beancount/beancount/src/python/beancount/query/shell.py",
 line 238, in dispatch
    return method(statement)
  File "/Users/dominik/Projects/beancount/fava/fava/core/query_shell.py", line 
83, in on_Select
    self.options_map)
  File 
"/Users/dominik/Projects/beancount/beancount/src/python/beancount/query/query_execute.py",
 line 288, in execute_query
    store = agg_store[row_key]
TypeError: unhashable type: 'Inventory'
```

Is it possible to combine sum and balance to produce the result I want?


-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20170303175843.11636.31378%40celery-worker-101.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to