Hi ! i have a problem with dataview that’s driving me nuts…
What I’m trying to do
I have a vault full of notes about people i work for. They have their birthdates in the file properties, and I’m trying to get a table with all of them with a few summary informations, including their age (for example, i need to see which kids are getting 18 in the near future).
But every solution i’ve seen comes with downsides that makes them unusable for me.
Basically, i need a formula that gives me the age, the answer can be “17 years, 11 months, 14 days, 2 hours, 50 minutes, 4 seconds, 303 miliseconds” for all i care, but i only want “17 years” to show up.
Things I have tried
i’ve seen many posts around here, on reddit and elsewhere, that (from my very basic comprehension of dataview) basically come down to two main options with variations.
date(today).year - birthdate.year as age
this takes the year we’re in and substracts the year of birth. In the example above, it would get me 18 today, but 17 last december.
round(dur(date(today) - birthdate).years, 0) as age
this calculates the age with precision to the day and rounds it. Mathematically. so here, below .5 it’s 17, above it’s 18. I can get some more decimals and get 17.45 but it’s not very useful, and i can’t get a table of all 17 years old, because if i add the line “where age =17”, those that are note exactly 17 won’t show
Basically i need “without the decimals” rather than “rounding up”. Is it possible ?
Thanks a lot