Search code examples
excelpower-automatepowerapps

How do I filter in PowerAutomate to return values in an Excel where the date equals yesterday?


I've been scouring the Internet for an answer to this question, but with no avail. Here's the situation: I want to create a flow in PowerAutomate that will run every day and send a list of all items with a submitted date of yesterday in an Excel column.

My flow is currently structured liked this: List rows present in a table with DateTime Format set to ISO 8601 -->Filter Array --> Compose

No matter how many times I try, I can not get the compose function to return the correct number of items with a timestamp of yesterday. For additional context, the source data is in EST in the MM/D/YYYY format. How do I get this filter to return all items with a submission date of yesterday?

Any help is greatly appreciated!

I've tried using the addDays(utcNow(),-1,'yyyy-MM-dd') but to no avail. I'm also not sure if the timezone is playing role with any of this? I've also tried to format the timestamp to match, but I have been really struggling with this.


Solution

  • Ensure both sides of filter array have the same date format.
    For the left side, try this expression:

    formatDateTime(item()?['Timestamp'], 'yyyy-MM-dd')
    

    And use the same format for the right side:

    addDays(utcNow(), -1, 'yyyy-MM-dd')