How to collapse bases to show DISTINCT (unique) values?

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

Hi All
To all my documents in Obsidian I add a series of Tags, one called

---
collection: 
---

This collection is tagged with (for example) ‘notes’ ‘images’ ‘weblinks’

Now I would like to create a Bases that can show me all my distinct (unique) collections collapsed to a single item, to get a clear overview over what collections I currently have.

Extra goal if possible. And if it can be really fancy, a count next to the collection that shows how many entries there is in each collection, aggregated count.

Things I have tried

The closest I have been able to get to this, is creating a new Bases, select ‘collection’ in Properties and ‘group by collection’, this groups all my collections into neat groups, but it does collapse all the cells into a DISTINCT value for each collection.

So instead of having one line called ‘notes’ which is the DISTINCT value of the collection, I have a line for each ‘notes’

Hope it makes sense
Thanks in advance

Hi

My appraoch

I hope I’ve understood your request. I’m a tinkerer, but this works for my system.

Create a formula then “groupe by” this formula

The tested property is PATROUILLE. The tested values are “350 Saisie Œuvres”, “350 Artistes”" etc.

The first test combines two values ​​for an item of the group, the others is used for one value for an item. The last test send all other values ​​in a same item.

The formula


if(PATROUILLE.toString().contains("350 Saisie Œuvres") || PATROUILLE.toString().contains("350 Saisie Ouvrage")  || PATROUILLE.toString().contains("350 Documents de références"), "02 Oeuvre", if(PATROUILLE.toString().contains("350 Artistes"), "01 Artiste", if(PATROUILLE.toString().contains("350 Mythologie grèco-romaine"), "04 Mythologique", if(PATROUILLE.toString().contains("350 Vocabulaire"), "03 Vocabulaire", "05 Autres") ) ))

hope this helps

Hi @allervoiretregarder

Thank you for your reply!

Unfortunately I could not get your solution to work for my needs, I am probably doing something wrong.

But I was able to solve my immediate problem using dataview

# DISTINCT view of Collections

```dataview
TABLE WITHOUT ID choice(collection, key, "No collection") AS "Collection", length(rows) AS "Count"
GROUP BY collection
SORT key ASC
```

And then making a secondary view to list all documents by name that has no collection set.

# List of documents with no Collections

```dataview
TABLE WITHOUT ID file.name AS "Name" WHERE !collection SORT file.name ASC
```

Thanks for taking the time to help me out!
Best regards

Hi,

if you just want to know all different values of a property and the count of related notes, have a look at notebook navigator plugin. besides being great, it can help you here as well.

Hi @Christian_Weiss

Thank you for your reply.
I had a look at the project here GitHub - johansan/notebook-navigator: A better file browser and calendar inspired by Apple Notes, Bear, Evernote and Day One. · GitHub

Right here and now notebook-navigator is probably out of scope for what I am trying to do, but thank you for the suggestion.

Best regards