Grpup multiple key values in metadata

Things I have tried

How do I get it to work when I have the following metadata:


key_dings:
- dings1
- dings2
- dings3
keyx: another_value

and the table query should not display

key_dings count
-.-.-.-.-.-.-.-.-.-.-.-.-.-
dings2. . . . . . . . 1
dings1
dings3

dings2 . . . . . . . . .1
dings3

but this:

tag … count
-.-.-.-.-.-.-.-.-.
dings1… 14
dings2… 7
dings3… 4

my dataview query is:

TABLE length(rows) AS num
WHERE contains(key_y,"another_value")
Group by key_dings
SORT Anzahl DESC

→ failed miserably, list like written above

if I test

GROUP BY key_dings[1]

it’s getting warmer, but of course it shows only the values of the 2nd (or x) tag, if I see this right, but it seems to count the entries right.
How can I get obsidian to group every value in the key_dings and count their numbers

best regards
anh

I think the issue might be that you can have multiple values for each key_dings field, and so Dataview is grouping by each combination. Could you try adding a FLATTEN key_dings clause before your GROUP BY clause?

TABLE length(rows) AS num
WHERE contains(key_y,"another_value")
FLATTEN key_dings
Group by key_dings
SORT Anzahl DESC
1 Like

Thanks Craig…
so simple, i didnt saw the wood… :sweat_smile:
I played around with that FLATTEN before, but it seems not in the right place as used to be.
well, learned something new again…now, rabbit, up to the next hole to dig :grin:

thanks to all in that forum for their effort.

till next time
anh

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