Not sure I understand where you got a warning from, but this is how I would 
do it;

2023-01-01 open Expenses:Utilities:Electric
2023-01-01 open Liabilities:ChaseCC

2023-12-31 open Expenses:Car                 USD
2023-12-31 open Expenses:Car:Energy      KWH
2023-12-31 price KWH 0.15 USD

2024-01-02 * "City Electric Co" ""
    Expenses:Utilities:Electric               42.24 USD
    Liabilities:ChaseCC

2024-01-24 * "Car electricity usage"
    Expenses:Utilities:Electric
    Expenses:Car:Energy                               10 KWH


And then would query it:

select account, SUM(convert(position,'USD',date))

And the result

[image: Capture.PNG]

You can play around with it here:

https://colab.research.google.com/drive/1RQAQ_3szZkZcr2RxFKi9fksLl9lDl8Fo#scrollTo=Leq1P87hpEm6



On Sunday, January 28, 2024 at 4:44:18 AM UTC+1 man...@gmail.com wrote:

> Thanks for the feedback. I got a warning somewhere - not sure if it was in 
> beancount or maybe paisa, saying that expense accounts can never have 
> withdrawals
>
> I wonder if a better method might be to not add this entry
>
>
> 2024-01-24 * "Car electricity usage"
>     Expenses:Utilities:Electric
>     Expenses:Car:Energy                               10 KWH {0.15 USD}
>
> And instead adjust the first entry from 
>
> 2024-01-02 * "City Electric Co" ""
>     Expenses:Utilities:Electric               42.24 USD
>     Liabilities:ChaseCC
>
> to
>
> 2024-01-02 * "City Electric Co" ""
>     Liabilities:ChaseCC                     -42.24 USD
>     Expense:Car:Energy                     10 KWH @ 0.15 USD
>     Expenses:Utilities:Electric       
>     # leave Utilities:Electric blank to auto-calculate that term from the 
> other provided terms.
>
> Then, no deduction occurs from an expense account.
>
> Although, I assume deductions must be allowed, for example if you get a 
> refund?
>
>    -k.
>
>
>
> On Wednesday, January 24, 2024 at 10:05:08 AM UTC-8 char...@gmail.com 
> wrote:
>
>> Looks good for me.
>>
>> The only thing is that I do not think you need this  {0.15 USD} notation, 
>> as such notation is used for tracking things at cost and is needed for 
>> stock trading.
>> You could have used the *@ 0.15 USD* notation, but even this is 
>> redundant, as you already have a price entry
>>
>> So, just like that
>>
>>
>>
>> *2024-01-24 * "Car electricity usage"    Expenses:Utilities:Electric    
>> Expenses:Car:Energy                               10 KWH *
>>
>>
>>
>> On Wednesday, January 24, 2024 at 5:41:23 PM UTC+1 man...@gmail.com 
>> wrote:
>>
>>> Hello,
>>>
>>> I used to track car gas usage with beancount. I now have an electric 
>>> car. It's plugged in at home, and is therefore part of my electric bill.
>>>
>>> I know exactly how many kWh go into my car each month, and would like to 
>>> get an estimate of what portion of my electric bill goes to the car. This 
>>> doesn't have to be precise - 0.15 $ / kWh is close enough, and we don't 
>>> have variable rate electricity (yet) where I live.
>>>
>>> What's the best way to do this? Currently I have
>>>
>>> 2023-12-31 open Expenses:Car                 USD
>>> 2023-12-31 open Expenses:Car:Energy      KWH
>>> 2023-12-31 price KWH 0.15 USD
>>>
>>> And then I post to an account with:
>>>
>>> 2024-01-02 * "City Electric Co" ""
>>>     Expenses:Utilities:Electric               42.24 USD
>>>     Liabilities:ChaseCC
>>>
>>> 2024-01-24 * "Car electricity usage"
>>>     Expenses:Utilities:Electric
>>>     Expenses:Car:Energy                               10 KWH {0.15 USD}
>>>
>>> So at the end of the month my electric bill is reduced by  $1.50 which 
>>> is placed into the Car:Energy expense account.
>>>
>>> Does this seem reasonable? Is anyone else doing this? Using a different 
>>> method?
>>>
>>> Thanks,
>>>
>>>    -k.
>>>
>>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/57b47a90-3b34-43b9-bb1e-36b9d558cbe2n%40googlegroups.com.

Reply via email to