Calculate table statistics without a plugin?

Things I have tried

I’ve looked for a plugin-free solution to calculate simple table statistics like percentages. So far, I haven’t found a built-in solution for this.

What I’m trying to do

I’d like to calculate simple statistics for a standard table, e.g. the percentage of occurrence of row values. So for the following table:

Date Exercise
02-10-2023 Run
02-11-2023 Walk
02-12-2023 Walk
02-13-2023 Run
02-14-2023 Run
02-15-2023 Walk
02-16-2023 Run

I’d like to calculate the occurrence of the Exercise column values, either in a table row or a separate summary table. For the table above I want to calculate the occurrence percentages of:

Run: 57%
Walk: 43%

Is this calculation possible without using a plugin, or is using a plugin like Advanced Tables or Dataview necessary?

There is no standard functionality to such calculations that I’m aware of, so some extension to the default app is needed.

Using dataview is a possibility if you use the javascript variant and do some table manipulation. Not neccessarily a neat and good looking solution. Then again, you wouldn’t normally need to look at it after it’s functioning, and it’ll keep the percentages updated all the time.

Using Templater could be a solution, where you for example could copy the table to the clipboard, and let the template do the calculations. Slightly better than the previous alternative. It also allows for insertion of the result into the note. This will produce a static result at the time of insertion of the template.

Using Advanced Tables is also an option, but to my knowledge it would require some additional columns. One for each alternative, aka one for “Run” and one for “Walk” and one for any other alternatives. After that is done, you could use sum functions and do some math to calculate the percentages. This option will therefore require some changes to your tables, and it will require a re-run of the tables functions if you change the table.

Does either of these options sound satisfying?

@holroy I appreciate the reply with options. I’m starting to think that a spreadsheet will be more appropriate for this data.

I did a quick experiment with saving the spreadsheet in my vault and I’m able to open it from Obsidian after changing the setting: Files & Links > Detect all file extensions.

This is probably sufficient for my use-case. Thanks again!

1 Like

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