Open valsor opened 4 years ago
Could you show a tiny mockup ?
In following example I use modified data from the tags tutorial:
; ================ begin file ================
2013/01/12 My Gas Station ; Boise-2013a:
Expenses:Travel $14.43
Liabilities:CreditCard
2014/01/12 My Gas Station ; Albany-2014a:
Expenses:Travel $15.43
Liabilities:CreditCard
2014/09/15 My Gas Station ; Albany-2014b:
Expenses:Travel $16.43
Liabilities:CreditCard
2016/01/12 My Gas Station ; Austin-2016a:
Expenses:Travel $17.43
Liabilities:CreditCard
2016/05/18 My Gas Station ; Fort Lauderdale-2016a:
Expenses:Travel $18.43
Liabilities:CreditCard
2016/11/21 My Gas Station ; Houston-2016a:
Expenses:Travel $19.43
Liabilities:CreditCard
; ================ end file ================`
$ hledger balance Expenses --pivot ROOT
$15.43 Albany-2014a
$16.43 Albany-2014b
$17.43 Austin-2016a
$14.43 Boise-2013a
$18.43 Fort Lauderdale-2016a
$19.43 Houston-2016a
--------------------
$101.58
The output should be the same as the normal balance output but with tags hierarchy instead of accounts hierarchy. It works as alternative hierarchy. The difference to the current solution is that we define no tag name as argument for --pivot. I think it could be some keyword, for example ALL or ROOT as above. Or maybe in such a style:
$ hledger balance Expenses --pivot tag: # meaning the root of tags hierarchy
$ hledger balance Expenses --pivot tag:Albany-2014a
$ hledger balance Expenses --pivot tag:John
$ hledger balance Expenses --pivot payee:John
$ hledger balance Expenses --pivot code:GTM
It can be hierarchical too. For example for big projects:
$ hledger balance Expenses --pivot tag:Remodeling-2016:Tools
$ hledger balance Expenses --pivot tag:Remodeling-2016:Materials
At the moment pivot feature works by pivoting and filtering at the same time. It means we should have at least two level of hierarchy. Pivoting on flat structure is not working. This is true not only for tags but for all possible fields. I suggest to separate pivoting and filtering with a benefit of being able pivoting on root of hierarchy or on simple flat one-level (tags or other possible fields) structure.
Another benefit is absence of ambiguity. For example if we have tag John and payee John and code John and maybe note John with the current solution we will probably have undesirable results by pivoting on John. Otherwise if we clear define the field on which we want to pivot we'll get predictable output.
It would be very useful to have pivot feature on tag (not a tag value). Then we could have for example balance report grouped by tag (maybe with hierarchy). For people who do not use multiple tag categories it's more easy to use simple tags without value. Or we can use hierarchical tags but without being limited to a single top level tag.