On 31/05/2022 08:49, Michael wrote:
> Hi everyone,
> I'm an accountant but new to Beancount, so apologies if these are easy
> questions or have been discussed before.
>
> My only plugin is "beancount.plugins.implicit_prices".
>
> Two Daily Commodity Prices
>
> Having an electric car, it's useful to track energy usage over time,
> which is in KWH. I have a script that imports my daily usage and creates
> the following journals:
>
> 2021-08-09 * "Energy Provider" "Daily energy"
> Expenses:Property:Utilities:Electricity:Standing 0.2381 GBP
> Expenses:Property:Utilities:Electricity:Offpeak 0.551 KWH @ 0.0476
> GBP
> Expenses:Property:Utilities:Electricity:Peak 3.156 KWH @ 0.1485
> GBP
> Assets:Debtors:Electricity
>
> (For those wondering about the accounting, my standing order also goes
> to Assets:Debtors:Electricity and each month I check that the balance of
> that account agrees to the statement.)
>
> As you can see, there is a standing charge in GBP, and then daily peak
> and off-peak (between midnight and 4am) prices. When I run reports,
Which reports?
> these convert all KWH to GBP using the Peak price, and ignore the
> Offpeak price. I believe this is a feature. However, is there a way to
> ensure that the correct conversion happens? I could use a different
> commodity code for peak vs offpeak, but I still want to track how many
> KWH we use in aggregate for each month etc.
A commodity can have only one price value per day, thus there is not way
to do what you want to do in the way you want to do it. The easiest
solution is to do no use the implicit_prices plugin and thus do not
derive prices from the costs.
> Posting level tags/metadata
>
> I am also keen to specifically track the amount of electricity cost that
> relates to the cost. My script identifies and tags energy usage relating
> to the car, giving a posting like:
>
> 2022-01-01 * "Energy Provider" "Daily energy"
> Expenses:Property:Utilities:Electricity:Standing 0.2381 GBP
> Expenses:Property:Utilities:Electricity:Offpeak 0.528 KWH @ 0.0476
> GBP
> Expenses:Property:Utilities:Electricity:Peak 7.055 KWH @ 0.1485
> GBP
> Expenses:Property:Utilities:Electricity:Peak 9.755 KWH @ 0.1485 GBP
> car: "Tesla"
> Assets:Debtors:Electricity
>
>
> You can see I've added the 'car: "Tesla"' metadata to the posting. I
> would like to be able to filter expenses for all costs relating to the
> Tesla (not just energy), but cannot see a way to do this in Fava
> (whereas tags and payee you can). Have I missed something, or do I need
> to do it manually in the Query page?
I don't use Fava but it is easy to do in BQL (Beancount Query Language)
which I think is what is under the hood of the Fava Query page.
> The other option would be to use
> Tags, but I believe these apply to the whole transaction rather than the
> individual posting - is there a plan to change this?
Tags (and links) apply to transactions, not to postings. IIRC there has
been some talk about allowing them on postings too, but almost certainly
it is not going to happen in Beancount 2.x
Cheers,
Dan