That query doesn’t count anything, it shows the first four elements in your list. So to get the first four closed tasks, you can do as the other post suggest, but if you want to count elements, you need to change the query a little more.
Thank you so much! both codes works for another two different fields on my vault.
But I’m still confused to how use the WHERE and FROM in these inline queries there is any documentation that explain them?
Some field have multiple values and in different folders so it’s hard to count specific value in these inline query. For example one of my fields are book subjects which every book may have multiple subject and set an inline query to count one of the subjects is the issue.
Are you able to list those subjects in an ordinary DQL query?
Either way you’d need to use flatten to split those fields having multiple values, in order to access/count them as separate entities.
The where and from clauses, and some of the other constructs in dataviewjs uses a function construct which takes some getting used to, but hopefully when seeing enough examples and playing around with them you’ll get the hang of it.
Try with page => page.subjects? .includes("africa_history") as the where clause. It’s the multiple values which most likely are setting you up for failure.
Do also test either query when there is only one value in the subjects field, to see/feel the paindifference.