Question about Dataview and adding values from one field's values

Things I have tried

I’ve been able to set up multiple Dataviews based on information in my in-progress novel. One thing I keep going back to Ulysses for is for a cumulative word count of all the chapters in my current project. I’m trying to solve this problem using Dataview but am not positive how to do what I want.

I currently use this query to create a table that lists the word count by chapter:

table chapter as CH, wordCount as "Word Count", povCharacter as POV 
from "" 
where (bookName = "The Sub Shop") AND (chapter != "00") sort chapter asc

It works great to compare the word count by chapter. Yay. Great.

Except…

What I’m trying to do

I want a way to see what the total word count is of everything in the “wordCount” column.

I’m just not seeing how to do it. Is there a way to count all the word counts that are returned?

That’s really all I want. I still go to Ulysses to get the total word count for the project at this point when I want a quick idea of where it’s at. I have both Ulysses and Obsidian tied to the same directory so the content can be updated in both places. But Ulysses includes all my frontmatter when it counts the totals, which isn’t ideal :smiley:

Can anyone help me? It’s probably something simple I just don’t know how to do.

Hi @katmoody ,

Fellow user here. Thanks for posting your question!

I created a couple of pages to represent chapters, and gave them “Book” and “Word Count” fields. I then created a report page, and was able to use GROUP BY and sum() to produce a total. I posted a screenshot below with the details. I hope this helps!

Craig

1 Like

So yours worked if I traded out the values, but I played with it a little bit and was able to use the following to get the results:

Table sum(rows.wordCount) as "Total Word Count"
From ""
Group by bookName

Thank you so much for taking the time to work through an example for me! I knew it could surely be done but just couldn’t quite figure it out! :smiley:

1 Like

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