Hi, group,


I’m trying to find a way to use Ledger to do differential analysis.


More specifically, I’m trying to use math to calculate an automated 
transaction's posting's factor from the value of another account. Below is 
an example.


Given this transaction which represents the total fixed costs for the year:


2019-12-09 transaction
    Expenses:Fixed costs  $120,000
    Owner's Equity

I want to allocate the fixed costs to each product category, with some 
pseudo automated transaction that looks like this:


= /^Expenses:Fixed costs$/
    $account:Product A     ((amount(account Income:Sales:Product A) / 
amount(Income:Sales)) * amount(Expenses:Fixed costs))
    $account:Product B     ((amount(account Income:Sales:Product B) / 
amount(Income:Sales)) * amount(Expenses:Fixed costs))
    $account:Product C     ((amount(account Income:Sales:Product C) / 
amount(Income:Sales)) * amount(Expenses:Fixed costs))
    $account               -1.0

This is clearly a bit much to stick in an automated transaction, but I 
understand that Ledger can be extended with Python. Would that be a good 
way to do the math above? I know a bit about coding, but I don’t know where 
I would start to tackle this challenge. Does anyone know where I might 
start with this?


Thanks for any help you can give!

-- 

--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/e83ce91e-a3de-4039-aedc-c683230faf68%40googlegroups.com.

Reply via email to