You can do so much fun stuff with Obsidian and Dataview. I added notes for all of my electronic gear and based on properties for purchase date and price an inline dataview calculates the costs per week for each item, every time the note is opened 🤩

This is the actual inline calculation for cost/week:

=round(number(replace(this.preis,",",".")) / number(durationformat(dur(date(now) - this.kaufdatum),"w")),2)

with

  • preis: price property; as I am located in GER I use a textfield with an entry like “42,99 €”; therefore the replacement of “,” by “.” and conversion to a number
  • kaufdatum: purchase date property
Obsidian dataview with costs per week based on purchase date and price

Update 2023-12-05

Here is a slightly improved version of the inline field:

=replace(string(round(number(replace(this.preis,",",".")) / number(durationformat(dur(default(this.nutzung_bis, date(now)) - this.kaufdatum),"w")),2)),".",",")

with

  • nutzung_bis: a properties date field that marks the end of usage; the cost is calculated either until this date or if it is missing until today

and it changes the ENG decimal point back to the GER “,”