From 10facfdb5002dfb3d7eb588b30639f5021aa1fce Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 5 Nov 2020 10:59:01 -1000 Subject: [PATCH] ;bal: improve -S docs (#1283, #1379) --- hledger/Hledger/Cli/Commands/Balance.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Balance.md b/hledger/Hledger/Cli/Commands/Balance.md index ef885c59a..f47107cea 100644 --- a/hledger/Hledger/Cli/Commands/Balance.md +++ b/hledger/Hledger/Cli/Commands/Balance.md @@ -43,9 +43,9 @@ $ hledger balance 0 ``` -By default, accounts are displayed hierarchically, with subaccounts indented below their parent. -At each level of the tree, accounts are sorted by [account code](/journal.html#declaring-accounts) if any, then by account name. -Or with `-S/--sort-amount`, by their balance amount, largest first. +By default, accounts are displayed hierarchically, +with subaccounts indented below their parent, +with accounts at each level of the tree sorted by [declaration order](/journal.html#declaring-accounts) if declared, then by account name. "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more compact output. @@ -184,6 +184,16 @@ This flag does not work if the report contains any mixed commodity accounts. If there are mixed commodity accounts in the report be sure to use `-V` or `-B` to coerce the report into using a single commodity. +### Sorting by amount + +With `-S`/`--sort-amount`, accounts with the largest (most positive) balances are shown first. +For example, `hledger bal expenses -MAS` shows your biggest averaged monthly expenses first. + +Revenues and liability balances are typically negative, however, so `-S` shows these in reverse order (largest last). +To work around this, you can add `--invert` to flip the signs. +Or, use one of the sign-flipping report like `balancesheet` or `incomestatement`, which also support `-S`. +Eg: `hledger is -MAS`. + ### Multicolumn balance report Multicolumn or tabular balance reports are a very useful hledger feature,