Hello guys. Thank you for checking out my thread. I appreciate it.
I’m trying to track different project progress by calculating the no. of status “pending” vs. no. of status “watched” of a particular folder.
Example of YAML with status watched
:
---
title: 2. SOLID Design Principles
due:
status: watched
---
Example of YAML with status pending
:
---
title: 3. Builder
created: 2022-04-12
due:
status: pending
---
With the following databiew query:
TABLE length(rows) as Tag
FROM "Courses/Design Patterns in Java"
WHERE contains(status, "pending") OR contains(status, "watched")
GROUP BY status
This gives the following table:
I could get the number of status field I want. But I don’t know how to divide no. of “watched” by no. of “pending” ((no. of watched) / (no. of pending)
). In the above case, 1/25
.
Here’s what I want to achieve in pseudo-code:
TABLE
count(number("pending")) as Pending,
count(number("watched")) as Watched,
(round((Watched/Pending)*100) + "%") AS Progress
FROM "Courses"
GROUP BY different folders under "Courses"
Expected result:
Below is the directory tree of “Courses”:
.
├── Courses
│ ├── Design Patterns in Java
│ │ ├── 00. MOC Design Patterns in Java.md
│ │ ├── 01. Introduction.md
│ │ ├── 02. SOLID Design Principles.md
│ ├── Understanding TypeScript
│ │ ├── 00. MOC Understanding TypeScript.md
│ │ ├── 01. Getting Started.md
│ │ ├── 02. TypeScript Basics & Basic Types.md
│ │ ├── 03. The TypeScript Compiler (and its Configuration).md
│ └── Understand JavaScript
│ ├── 00. MOC Understand JavaScript.md
│ ├── 01. Introduction and The Goal of This Course.md
│ ├── 02. Setup.md
│ ├── 03. Big Words and Javascript.md
Any help is much appreciated. Thank you again!