Re: Automated transaction amounts "doubled"

2022-11-10 Thread Robert Shanley
Thanks, John. That clarification really helps.

On Thu, Nov 10, 2022 at 10:30 AM John Wiegley  wrote:

> > "RS" == Robert Shanley  writes:
>
> RS> journal.txt:
> RS> = expr payee == "Joe"
> RS> SetAside$100
> RS> MoreMoney  -$100
>
> RS> 2022/01/05 * Joe
> RS> Stuff $600.00
> RS> Checking
>
> RS> ledger -f journal.txt balance :
>
> RS> $-600.00  Checking
> RS> $-200.00  MoreMoney
> RS>  $200.00  SetAside
> RS>  $600.00  Stuff
>
> RS> What am I doing wrong?
>
> Your automated transaction expression is matching each posting within your
> transaction, since they both have a payee of Joe. Imagine your file had
> looked
> like this:
>
> 2022/01/05 * Joe
> Stuff $600.00
>
> 2022/01/05 * Joe
> Checking
>
> That's where the doubling is coming from.
>
> John
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPmauXPtisSyqAvSXhnOzYQ%3DoA3MAAQPHpNVL8Z0G2DCwAx-6Q%40mail.gmail.com.


Re: squash weekly totals across sub-accounts?

2022-11-10 Thread Alan
Thank you for your quick reply; and I apologize for asking nearly the same 
question I previously asked 
 (more 
than 10 years ago!). (That's why I quickly tried to remove my OP from 
yesterday.)

For my purposes here, "-n" works well enough. And, from Martin's response, 
I agree that #1901 looks like an even better soluion in general. So I'm all 
set for now.

But just so as I'm not leaving you hanging, here's a simple example:

2022/9/1   Safeway
Expenses:Food:Groceries   $10.00
Assets:Cash

2022/9/15  KFC
Expenses:Food:Chicken   $5.00
Assets:Cash

2022/9/21   Another
Expenses:Food   $1.23
Assets:Cash

The sum that I want for the monthly total is $16.23. But if I type `ledger 
-M --depth 2 reg expenses.food` I get $1.23.

On Wednesday, November 9, 2022 at 5:39:34 PM UTC-8 jwie...@gmail.com wrote:

> > "A" == Alan  writes:
>
> A> I have some of my Expense accounts organized hierarchically. For 
> example,
> A> rather than simply "Expenses:Food" I have a few accounts, such as:
>
> A> Expenses:Food:Groceries
> A> Expenses:Food:Chicken
> A> Expenses:Food: ... (a few others)
>
> A> But now I would like to get a weekly or monthly subtotal (using `-W` or
> A> `-M`), summed across all Food categories. If I just query `reg
> A> Expenses:Food` then of course as a regular expression that matches all 
> of
> A> the sub-categories individually. If I add `--depth 2` then it ignores 
> all
> A> the subcategories, reporting only the cases where the ledger has just
> A> "Expenses:Food" exactly.
>
> Actually, `--depth 2` should be exactly what you need, according to the 
> --help
> description:
>
> Limit the depth of displayed accounts in balance and register reports. Any
> accounts of greater depth are folded into their parent at the specified
> level. For example with --depth 2 the account
> Expenses:Entertainment:Dining would be folded into Expenses:Entertainment
> for display. Importantly, this is a display predicate, which means it only
> affects display, not the total calculations.
>
> I'm rather surprised if it is truncating the totals as you describe. Can 
> you
> reproduce the issue in a small test case?
>
> John
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/968bcdfe-d295-4e08-9ab4-b5cdb1c23d35n%40googlegroups.com.


Re: Automated transaction amounts "doubled"

2022-11-10 Thread John Wiegley
> "RS" == Robert Shanley  writes:

RS> journal.txt:
RS> = expr payee == "Joe"
RS> SetAside$100
RS> MoreMoney  -$100

RS> 2022/01/05 * Joe
RS> Stuff $600.00
RS> Checking

RS> ledger -f journal.txt balance :

RS> $-600.00  Checking
RS> $-200.00  MoreMoney
RS>  $200.00  SetAside
RS>  $600.00  Stuff

RS> What am I doing wrong?

Your automated transaction expression is matching each posting within your
transaction, since they both have a payee of Joe. Imagine your file had looked
like this:

2022/01/05 * Joe
Stuff $600.00

2022/01/05 * Joe
Checking

That's where the doubling is coming from.

John

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/m2bkpe1zvg.fsf%40newartisans.com.