Skip to main content

Notifications

Power Automate - General Discussion
Answered

Filter Query by Date

(2) ShareShare
ReportReport
Posted on by 29
Hi there!
 
I had my flow set up to run once a week with all of the data from the following week. However, it has been decided that we need the data to run twice a week, once on Thursday mornings to grab the data from Monday- Wednesday, but then we need it to run on Friday at noon and only want the data that came in on Thursday and Friday. With that, how can I filter the data to only show me the days I need for each run? 
There is no data coming in over the weekend, and I also don't want to risk the Thursday run pulling data from the prior week.
I have tried several ways by doing a filter query and I tried but setting a condition, but nothing seems to work. 
I am including the flow with current set up for clarity of what I am working with.
Categories:
  • Verified answer
    ivan_apps Profile Picture
    ivan_apps 2,187 on at
    Filter Query by Date
    It would be important to know the schema of your excel document. I assume there is a ‘created on’ or some other date column that allows you to know what date the data came in at. You then can use utcNow() and dayOfWeek() expressions to determine what day you are executing on if you are set to run Wednesdays and Friday. In either case you basically are doing an addDays(utcNow(), -2) to set your start date. Use formatDateTime() to adjust to whatever time you need, then use the following sample Odata query:
     
    createdon ge addDays(utcNow(), -2) and createdon le utcNow()

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard