Dataview query to show tasks in a table (tasks across columns, days of the week as the rows)

I’ll leave one example here based in one point: adding a date field in each note.

example note

An example note (with an inline field to fix a date, but you can use a field in frontmatter):


dDate:: 2022-12-24

## Denni's Goals

- [x] 🐷 Create PIGGS
- [ ] πŸ‹οΈ Movement
- [ ] πŸ“– Bible App
- [ ] πŸ’° EveryDollar
- [ ] πŸ› Make the bed
- [ ] πŸ’‘ Learn a new thing
- [x] 🎸 Guitar - 10 minutes

the query

Now a query based in these conditions:

  • as I see in your mockup, to you the start of the week is in sunday… so, for the case the weekly query is placed in a note with a Saturday date. why? to use a comparison and calculation based on the date in that field
  • because you use in the section title an ' (β€œDenni’s Goals”) you need to ignore it in WHERE meta(T.section).subpath = "Dennis Goals"
  • the query is based in a fixed list of ordered seven tasks
dDate:: 2022-12-24

```dataview
TABLE WITHOUT ID
	upper(dateformat(dDate, "cccc")) AS Weekday,
	choice(rows.T.completed[0], "🟒", "❌") AS 🐷,
	choice(rows.T.completed[1], "🟒", "❌") AS πŸ‹οΈ,
	choice(rows.T.completed[2], "🟒", "❌") AS πŸ“–,
	choice(rows.T.completed[3], "🟒", "❌") AS πŸ’°,
	choice(rows.T.completed[4], "🟒", "❌") AS πŸ›,
	choice(rows.T.completed[5], "🟒", "❌") AS πŸ’‘,
	choice(rows.T.completed[6], "🟒", "❌") AS 🎸
FROM "your-folder-path"
FLATTEN file.tasks as T
WHERE meta(T.section).subpath = "Dennis Goals"
WHERE dDate <= this.dDate AND dDate >= this.dDate - dur(6days)
GROUP BY dDate
SORT dDate ASC
```

Isn’t an elegant query (with undesirable repetitions), but is one way inside dql limitations.

the result

(weekdays are in portuguese, my local language)

3 Likes