Dataview Plugin - Count Items

Notes YAML is set to:

tag: client, mva
title: "Long Title of the note"
clinic: "Clinic Name"
status: active, contact
supervisor: Anna
name: "John Smith

Questions

  1. What would be the formula that I can use to create a Table to count the number of active Clints in a particular clinic?
TABLE 
FROM #client
GROUP by clinic
  1. What would be the query to count the total number of notes (active clients)?
1 Like

This query gave me a table of number of clients by clinic:

```dataview
TABLE length(rows) as Number
FROM #client
GROUP BY clinic
```

And this inline query gave the the total number of clients:

Number of clients: `$= dv.pages("#client").length`

What is the exact code?

```dataview
LIST
FROM #client 
Number of clients: `$= dv.pages("#client").length```

Hi.

As @Craig said, you have two solutions:

  1. a table with the number of clients by clinic (firs query);
  2. or an inline JS query (you need to enable inline javascript queries in Settings > Dataview) to obtain the total number of clients.

These are two different queries. You can’t mix DQL with javascript queries.

My suggestion, as always, it’s about the need to read the plugin documentation, because in this exchange of help we need to discuss with some common basic language. :slight_smile:

https://blacksmithgu.github.io/obsidian-dataview/

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