Dataview to summarize game record results

What I’m trying to do

I log each time I play a specific game. Each is a separate note in Obsidian. I want to summarize my wins and losses by opponent.

Things I have tried

This is the dataview I am currently using. Obviously it gives me wins by opponent in one table, and losses by opponent in another.

The final dataview is just my list of games view, but should give you an idea of what properties I’ve set.

Thanks in advance

TABLE WITHOUT ID Result, length(rows) as Wins
from #gamerecord/infinity AND -"Templates"
GROUP BY Result
TABLE WITHOUT ID OpPlayer AS Opponent, length(rows) as Wins
from #gamerecord/infinity AND -"Templates"
WHERE Result = "Win"
GROUP BY OpPlayer
TABLE WITHOUT ID OpPlayer AS Opponent, length(rows) as Loss
from #gamerecord/infinity AND -"Templates"
WHERE Result = "Loss"
GROUP BY OpPlayer
TABLE WITHOUT ID file.link AS Game, Scenario,Date-Played, Army, OpPlayer AS Opponent, OpFor AS "Enemy Army", Result, Score
from #gamerecord/infinity AND -"Templates"
SORT Date-Played DESC

Is there a Dataview forum I should use instead?

You’re quite close to a good result, but instead of using WHERE clauses, you need to filter on the grouped result, and counting the elements in the filtered list.

I don’t have a test suite set up for you data, so the following query is untested, but try this one:

```dataview
TABLE WITHOUT ID key AS Opponent, Loss, Wins
from #gamerecord/infinity AND -"Templates"
WHERE Result = "Loss"
GROUP BY OpPlayer
FLATTEN length(filter(rows.Result, (res) => res = "Loss")) as Loss
FLATTEN length(filter(rows.Result, (res) => res = "Win")) as Wins
```

Hopefully this works as you want it to!

Regarding a Dataview forum, I’ve heard about some Discord servers, and you do have the github repository where you could raise issues. But I think you just got unlucky not having an answer (for some time) in this forum.