Things I have tried
TABLE length(rows) as Number
FROM #programming
WHERE file.ctime.year = this.file.ctime.year
What I’m trying to do
count all note with #programming tag created this year in my yearly note
TABLE length(rows) as Number
FROM #programming
WHERE file.ctime.year = this.file.ctime.year
count all note with #programming tag created this year in my yearly note
I don’t know about your question. But if you are not aware, don’t forget that you can’t always trust creation and modified time, especially if you are syncing notes across different operating systems, or if any external files edit your notes.
Some people store that data in YAML front matter, just in case, as a workaround. Then you can query that metadata.
Just something to keep in mind if you are planning on trusting this view over the long term.
Either of these work?
```dataview
TABLE
FROM #programming
WHERE file.ctime.year = 2023
```
```dataview
TABLE
length(rows.file.name) as Files
FROM
#programming
WHERE
file.ctime.year = 2023
FLATTEN
file.tags as tag
GROUP BY
tag
```
You query its work but its show the count of notes with every tag in any note have the #programming tag , example :
---
tags: programming , python , linter
---
the dataview show the count of notes created in 2023 who have the tag programming
& the count of notes created in 2023 who have the tag python & the count of notes created in 2023 who have the tag linter extra …
i just want to show the count of notes with specific tag like #programming ,ex:
tags | number of notes in 2023 |
---|---|
#programmings | 12(notes) |
dataview ...
noteIt’s not exactly in the format you asked for, but does this come close to what you want:
```dataview
TABLE WITHOUT ID
length(rows.file.name) as count,
length(sum(rows.file.etags)) as noOfTags,
length(filter(sum(rows.file.etags),
(t) => contains(t, "#programming"))) as "programming",
length(filter(sum(rows.file.etags),
(t) => contains(t, "#python"))) as "python",
length(filter(sum(rows.file.etags),
(t) => contains(t, "#linter"))) as "linter"
FROM #programming
WHERE file.ctime.year = 2023
GROUP BY true
```
A similar query with tags that are in my test vault, gave this result:
Think holroy has probably given a working solution.
I was able to get rid of additional tags with the test queries below, but didn’t look at the total count as holroy has already covered that.
```dataview
TABLE
length(rows.file.name) as notes
FROM
#programming
WHERE
file.tags
FLATTEN
file.tags AS tag
WHERE
contains(tag, "programming")
AND
file.ctime.year = 2023
GROUP BY
tag
```
```dataview
TABLE
length(rows.file.name) as notes
WHERE
file.tags
FLATTEN
file.tags AS tag
WHERE
contains(tag, "programming")
AND
file.ctime.year = 2023
GROUP BY
tag
```
if I could give two solution badges, I would give you one
I think your answer is correct, but as you said, it is not the format i want, but it does answer my additional question about the number of all notes written in the year 2023.
Thanks for that.
That image with many programming language tags you presented earlier, how did you format that? What is the markdown behind it?
I just use cssclass: cards
in my frontmatter it’s a css snippet from minimal theme
I just discovered that the Column Count displays the number of #programing
notes instead of the total number of notes
Wasn’t that part of your prerequisites, that you only want to pick notes having that particular tag? So that should give you the total number of notes, unless some notes have it doubled up somehow…
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.