What I’m trying to do
I am trying to set up an overview of my regular spendings.
I have created a template that I’m using for each spending as follows:
up:: [[wiederkehrende Ausgaben MOC]]
Tags:: #Finanzen/Ausgaben/regelmäßig #Finanzen/Kategorie
Betrag:: 0.00€
Frequenz:: 1
BetragMtl::`=number([[{{title}}]].Betrag)/number([[{{title}}]].Frequenz)`
BetragYrl::`=number([[{{title}}]].Betrag)/number([[{{title}}]].Frequenz)*12`
Verwendungszweck::
Empfänger::
IBAN::
Dauerauftrag:: nein / ja
Laufzeit::
Rücklagen:: -
# {{title}}
as you can see there are the “BetragMtl” and “BetragYrl” values that are calculated via dataview inline
these are reported by an overview-page that hosts a dataview table:
TABLE WITHOUT ID
file.link as Was,
Betrag,
Frequenz as "Alle # Monate",
Laufzeit as bis
FROM #Finanzen/Ausgaben/regelmäßig and !"Extras/templates/Template - wiederkehrende Ausgaben"
SORT Laufzeit ASC
now I’m trying to get a SUM of BetragMtl a for easy comparing my monthly earnings vs spendings
Things I have tried
TABLE WITHOUT ID
sum(map(rows, (r) => default(r.BetragMtl, 0))) AS "Monatlich"
FROM #Finanzen/Ausgaben/regelmäßig and !"Extras/templates/Template - wiederkehrende Ausgaben"
GROUP BY true
now this actually works somehow with one note
but as soon as the second one comes in I’ll get the following message:
so I think that the inlines are processed at runtime rather than calculating the results and only then calculating the sum
in order to verify that I already modified the two notes so “Betrag” only contains number values and modified the sum-function to get the “Betrag” value. That works - so I’m sure it must be something with the “stacked” dataviews…
also tried my own modified version of smiggles’s DataviewJS solution from the Dataview sum of all prices in table - Help - Obsidian Forum
my modified version looks as follows:
let pages = dv
.pages('#Finanzen/Ausgaben/regelmäßig and !"Extras/templates/Template - wiederkehrende Ausgaben"')
let totalPrice = pages.map((page, index) => [
page.file.link,
page.BetragMtl,
page.BetragYrl
]);
totalPrice["values"][totalPrice.length] = [
"***BetragMtl***",
"",
"",
dv.func.default(dv.func.sum(pages.BetragMtl), 0),
];
dv.table(["Was", "Monatlich", "Jährlich", "Total"], totalPrice);
still the issue that the value is not displayed - but the error message…
any ideas?