Derive frontmatter attributes from others with Templater

I am new to Obsidian and try to build a habbit tracker, following along Sergio’s YT tutorial

What I’m trying to do

This works fine, but I also want to have “grouped” habit statistics.

For example, in the case I walk the dog, or run, or cycle, I get an attribute physicalActive: true.

Things I have tried

Templater: Habit Tracking Templater Functions

<%*
function activeBoolNumber(...params) {
    return params.some(param => Boolean(param));
}
%>

Daily Note: 02 - BuJo/2025/January/2025-01-14

---
tags:
  - habbit-tracking
aliases: 
habits:
  dogwalk: 1
  hike: 0
  stretching: false
  physical_active: <% tp.user.habitGroupsBoolMerge(tp.frontmatter.habits.dogwalk, tp.frontmatter.habits.hike, tp.frontmatter.habits.run, tp.frontmatter.habits.cycle, tp.frontmatter.habits.workout) %>
  run: 0
  cycle: 0
  workout: false
  sport: <%* activeBoolNumber(habits.run, habits.cycle, habits.workout) %>
---

...

Habit Tracker:

In the file somewhere (can’t post the full files, as the code blocks would be nested):

Working

This renders the Tracker view with the streak

datasetName: Dog Walk
searchType: frontmatter
searchTarget: habits.dogwalk
folder: 02 - BuJo/2025/January
month:
  startWeekOn: 'Mon'
  color: steelblue

Not working

This gives the following error: No valid Y value found in notes

datasetName: Physical Active
searchType: frontmatter
searchTarget: habits.physical_active
folder: 02 - BuJo/2025/January
month:
  startWeekOn: 'Mon'
  color: steelblue

I got the Templater user function working, but to my understanding I can only use it either on creation of a new daily note, or have to run in manually and replace it with actual values. Once replaced, changes on the input will not reflect change in the output anymore, of course.

Actually, I came to the conclusion this was the wrong approach.

Is there any other way to calculate a second value based on others to be desplayed by a graph / table?

Are queries the way to go for Tracker?

I can’t answer the question without having to do the legwork I’m afraid.
But seems like you are handy with code.

If no one can solve your problem I propose you give searching for habit trackers on the forum a go.
I added some customization guide of some sort to this one:

Find the zip to download near the end of the thread as the introduction write-up leads to a 404.

It needs the Datacore plugin installed via Brat plugin.
You can easily change or add to the frontmatter keys your own custom properties.
More of an eye candy, that one, I’ll admit.

I’ve not used Tracker a lot since I felt it unstable, and never understood why it worked in some cases, and not other very similar cases. But that could just be me. Regarding your issue on the other hand I’ve got some experience and can think of some different approaches.

Doubling the template

If you just want the extra calculation of physical-active and sport done once some time after you’ve filled in the other properties, you could let the first run insert some template code, and then when you’re ready you could evaluate templates in the current file.

But if you then update the frontmatter again, you need to do a manual update of the related properties.

Use metabind

If you look at this View Fields | Meta Bind Docs , you can see a method for creating a view field, which in turn can be stored back into a other property.

This might be the better option.

Using a query

Unless you’re doing a query directly related to or from within Tracker, a query would be depending on you to actually execute before viewing your tracker. Just saying.

With that said, you could easily use Dataview to dynamically calculate the value, but would need to switch to dataviewjs to store it back as a fixed value in the properties. The latter can be done through the use of app.fileManager.processFrontMatter().