You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trying to compute the maximum balance of the Assets:Foo account with a query like
SELECTdate, balance WHERE account ='Assets:Foo'ORDER BY balance ASCLIMIT1
results in
date balance
────────── ────────────
2024-06-17 -1000.00 EUR
which is likely not the desired result.
This happens because each posting is considered in isolation. This can be solved finding a way to report the balance only after all the postings relative to a transaction have been applied.
Making balance() a function similar to a windowed aggregate function, this could look something like:
SELECTdate,
balance(amount) AS balance
FROM (
SELECTdate,
sum(position) AS amount
FROM
postings
GROUP BY
id
)
ORDER BY
balance
LIMIT1
The text was updated successfully, but these errors were encountered:
Given a ledger like
trying to compute the maximum balance of the
Assets:Foo
account with a query likeresults in
which is likely not the desired result.
This happens because each posting is considered in isolation. This can be solved finding a way to report the balance only after all the postings relative to a transaction have been applied.
Making
balance()
a function similar to a windowed aggregate function, this could look something like:The text was updated successfully, but these errors were encountered: