Dataview: Filtering by type of links

Hello

I have two type of note: Mission and Phase. I use composed:: to link Mission to Phase, I have several Phase for one Mission. On both notes, there is the duration property.

So I am looking for a way to check if the sum of the duration of Phases (related to a specific Mission) is less than the duration of the Mission that are linked to Phase through composed::

I tried several ways without success.

regards
Michel

Are you using Dataview inline properties? Adding that info will focus the discussion and replies you get.

Yes, I use YAML for the property, and the feature to type the link with this syntax xxxx:: [[note]]

I added “Dataview” to the topic title.

In order for someone to help you, add:
Example YAML with properties, and what types of values you have or are expected (check types.json file in .obsidian folder for the prop in question).
Will save your helper time, as you might have string where number expected, etc.

Add here also some of the earlier tried queries.

If you create a prompt for AI, you also need to tell the bot what you have.

Give yourself a chance to get help.

Also, when you add here anything, make sure you add it in

```
stuff in 3 backticked fence
```
1 Like

So if all of your duration values use the recognized duration format, such as [duration::2.5 days], and each of your composed properties contains one link to one phase note, such as:

… then you could get a summary and duration check like this:

… by using this Dataview query:

```dataview
TABLE WITHOUT ID
	file.link AS "Mission",
	duration AS "Mission duration",
	composed AS "Phases",
	composed.duration AS "Phase durations",
	sum(composed.duration) AS "Sum of phase durations",
	choice(duration >= sum(composed.duration), "Okay", "<span style='color: red'>Phase durations exceed mission duration</span>") AS "Duration check"
WHERE composed
```

But if that’s not your note structure, then try to give more info about it, like Yurcee said :arrow_up:.

1 Like

Thank you so much!!! I didn’t yet understood how that works, but that works as excepted. I will analyse carefully. Thank you again.

1 Like