Help trying to display number of days project worked on and when completed

In short, what I’d like to do is set up a dataview table that shows how many days I’ve been working on a project (days from file creation date to the present day). But also, to only have projects “in process” (not completed) populate the table. Or, if possible, have a separate column indicate whether a project is in process or completed and if changed to completed, stop adding any more days so I know how long it took to complete.

I have a central note where I like to track my present projects, tasks, etc. I presently use the following dataview code block to help keep track of work memos:

dataview
TABLE Stage, dateformat(file.mtime, "dd.MM.yyyy") AS "Last Modified"
FROM !"➕ Extras"
WHERE Stage = "🚧"
LIMIT 25 

(I keep my templates in the “:heavy_plus_sign: Extras” folder, hence omitting any files from that folder.)

My template for writing articles and/or memos presently uses the following YAML metadata:

---
Stage: ⚙️|🚧|🏆
---

The gear indicates it’s in the early research phase, the construction post is for when I get to the drafting phase, and the trophy signifies completion.

I’m open to adding some more items to YAML such as:

Start_Date: <% tp.date.now("YYYY-MM-DD") %>
Completion_Date:

But if it’s possible to do what I’d like to do without changing my template I would much prefer that.

Thank you in advance for any help.

Hi.

  1. If you want to see both types (“:construction:” and “:trophy:”) and stop the account of days for completed projects, then you need to add a field as "Completion_Date:`
  2. If the creation date of the file is a valid date for your intents, then you don’t need to add a new field to start date. (but attention: if you use some kind of synchronization between devices I’m not sure if the creation date is a save date to use)
  3. To start check this query:
TABLE
	Stage,
	dateformat(file.cday, "dd.MM.yyyy") AS "Creation",
	dateformat(file.mtime, "dd.MM.yyyy") AS "Last Modified",
	choice(Stage = "🚧", (date(today) - file.cday).days + " days", "**" + (default(Completion_Date, date(today)) -  file.cday).days + " days **") AS "Number of days",
	dateformat(Completion_Date, "dd.MM.yyyy") AS "Completion date"
FROM !"➕ Extras"
WHERE Stage = "🚧" OR Stage = "🏆"
SORT default(((x) => {🏆: 1, 🚧: 2}[x])(Stage), 3) ASC, file.cday ASC
LIMIT 25 
2 Likes

Amazing, thank you so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.