Help: Need Datview Query: Total # Of Results Returned

Blog workflow, each note (post) has tags for “Published” or “In-Progress”.

I have a table (not an actual table, just 2 columns) that returns a list of posts “Published” on one side and “In-Progress” on the other for specific categories. All I’m looking for is to have the the total number of results returned on each side at the bottom of each table column … ie Published = 37, In-Progress = 12.

Ideally, I would be able to put some code in that displayed how many notes with: #category #published … etc.

Sorry, I’ve looked everywhere for a solution, but it seems like everyone is trying to do something more complicated than what I am trying to accomplish.

Thanks for any help :wink:

What’s your initial dataview query?

Thanks so much for responding!

The initial dataview query is very simple:

```dataview
LIST
FROM #category-1 AND #published
SORT file.name asc

But this query doesn’t give you a files from “#category-1” in one column and from “#published” in other…

I’m pointing this because I need to understand your data structure and the way how you list files to one specific tag in one column and to another tag in another column.

If I ignore this step, I can give you a fast answer: do a total at the bottom of each column isn’t possible in dql. Well, it’s possible, but only with many “tricky” ways. In dataviewjs that is possible also with a tricky ways (but more flexible), because there’s no dataview function available to achieve that.

But you can achieve in easy way a similar result but in horizontal way. Try this query:

TABLE WITHOUT ID
	Tags,
	length(rows) AS Total,
	rows.file.link AS Files
FROM #published OR #category-1
FLATTEN file.etags AS Tags
WHERE Tags = "#published" OR Tags = "#category-1"
SORT file.name ASC
GROUP BY Tags