formatDateTime(item()?['DateTimeReceived'], 'yyyy-MM-dd') failed because item()?['DateTimeReceived'] returned Null.
That can happen for either of these reasons:
1. The column/property exists but is empty for some email.
2. More likely here: DateTimeReceived is not the correct property name, so Power Automate returns null. In my experience it is receivedDateTime. Please check in your Get emails action output.
Also check the manual trigger date field. Even if the input is displayed as ArchiveDate, the internal name may still be date. In that case, use:
triggerBody()?['date']
instead of:
triggerBody()?['ArchiveDate']
I would try this in Filter array advanced mode:
@and(
not(empty(item()?['receivedDateTime'])),
not(empty(triggerBody()?['date'])),
equals(
formatDateTime(item()?['receivedDateTime'], 'yyyy-MM-dd'),
formatDateTime(triggerBody()?['date'], 'yyyy-MM-dd')
)
)
The not(empty(...)) checks prevent formatDateTime() from running on a null value. The formatDateTime(..., 'yyyy-MM-dd') part compares only the date portion, since the email received date/time usually includes a time value.