# How to auto-relate notes to journal entries with a formula

**URL:** <https://community.fibery.io/t/how-to-auto-relate-notes-to-journal-entries-with-a-formula/5308>\
**Category:** Get Help\
**Created:** [October 19, 2023, 2:17pm UTC](https://community.fibery.io/t/how-to-auto-relate-notes-to-journal-entries-with-a-formula/5308 "2023-10-19T14:17:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuri\_BC](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yuri_bc/32/8803_2.png) [@Yuri\_BC](https://community.fibery.io/u/Yuri_BC)\
**Post date:** [October 19, 2023, 2:17pm UTC](https://community.fibery.io/t/how-to-auto-relate-notes-to-journal-entries-with-a-formula/5308/1 "2023-10-19T14:17:06Z")

</div>

My Journal entries database is ‘Y Journals’  
My Notes database is ‘Y Notes’, which has a many to one relation to an Y Journal.

My goal is upon creation to automatically relate Y Notes to an existing Y Journal that has the date of Today.

I created an automation in the Y Notes database:  
When Y Note created,  
Then Updatea Y Journal  
Fields Y Journal is a formula:

```auto
[Y Journals]
  .Filter([Creation Date] = Today())
  .Sort([Creation Date])
  .First()

```

However, that formula does not work. Any ideas?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 27, 2023, 3:45pm UTC](https://community.fibery.io/t/how-to-auto-relate-notes-to-journal-entries-with-a-formula/5308/2 "2023-11-27T15:45:53Z")

</div>

The reason that it does not work is that `Creation Date` and `Today()` do not have the same data types.  
`Creation Date` is a datetime, but `Today()` is a date.  
When comparing them, the value of `Today()` will be typecast to datetime, using midnight as the time (so `dd/mm/yyyy` will become `dd/mm/yyyy 00:00`)

In general, you can use  
`DateTime >= Today() and DateTime < (Today() + Days(1))`

but actually in your specific case, `[Creation Date] >= Today()` will suffice, since there can’t be any items with a creation date after midnight tomorrow(!)
