I want to get all the tags I've used in my vault and the count of all unique tags displayed in one line

What I’m trying to do

So I want to have quick summary of all the available tags in my vault and number (count) of tags, in one line.

Something like this:

Total Unique Tags (198) Tags
198 #programming, #obsidian, dataview, #log, #snippets, #table, #list, #task, linux, macos, api, #blogs, #archive, #python, #ruby, #productivity, #books, #bugs, #documentation, #experimental

Things I have tried

This gives a list of tags and the number times that tag is used. Now I want to get that list and one count the number of unique tags and then join them to one line.

LIST WITHOUT ID length(rows) + " note(s) with tag " + "  " + tgs
FROM "/"
WHERE file.etags
FLATTEN file.etags AS tgs
SORT length(rows) DESC

I have no idea whether that is possible, I think it. I just hope that I don’t have to use dataviewjs as I’m not at all versed in that.

I searched the forum, but I didn’t find anything close to what I’m trying to do, perhaps I’m bad at describing it in search terms. If this already exists please point me to the post.

Anyway, any help on this would be greatly, appreciated. Thanks.

This is not tested, and I’m not sure whether it’s the most efficient way of doing it. But it could work…

TABLE WITHOUT ID length(rows) as "Tag count", join(rows.unique, ", ") as "Unique tags"
WHERE file.etags
FLATTEN file.etags as tag
FLATTEN rows.tag[0] as unique
1 Like

Wow!! This is exactly what I’m looking for!!! It shows all the tags nice sorted alphabetically.

Thank you!!

I think I understand most of it except the last grouping?

Why “GROUP BY true” ? How did you come up with that?

The first group by is used to group by tag, aka single out unique tags and gatherc each n of them in list under each tag. The last group by is just used too gather all the rows of tags into a single row.

I am mean I had no idea that “GROUP BY true” was even thing.

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