web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Dynamic filter on date...
Power Automate
Answered

Dynamic filter on date column using get rows action for SQL server in PowerAutomate

(0) ShareShare
ReportReport
Posted on by 19

Hello Power users,

I am trying to dynamically filter on a date column from SQL server table using the "Get rows (V2)" action, but I cannot get it to work and will appreciate your help. 
Some background:

In my SQL server table I have a "followupdate" column, I would like to use powerautomate to send reminder emails to users 7 days prior to follow up date. In the filter query of "Get rows (V2)" column I have this:

Screenshot 2021-11-10 203136.png

Inside the expression i have the below code:

 

 

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

 

 

The flow runs fine and it also spits the correct date (todays date +7), and I know that I have few dates which should have been retrieved based on the above code, but unfortunately I do not see any rows retrieved.

 

PS: Earlier I had date and time column in sql for that I used this expression

 

 

 

addDays(utcNow(),7,'yyyy-MM-dd 00:00:00.000')

 

 

 

This did not work too, and therefore I created just a date column with no time. 

Any help on this is much appreciated.
Thank you in advance.

Categories:
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @ysharma  Please make sure that your addDays() and followupdate have same date format. First check what kins od date format return by followupdate column.

    Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • ysharma Profile Picture
    19 on at

    Hi @Hardesh15 , 

    thank you for your reply. I did check the date formats and it is the exact same. I have two date columns in my table, one is date and time and the other is just date. When I used date and time I made sure that the adddays() expression returns the date and time in the same format and used the below expression

    addDays(utcNow(),7,'yyyy-MM-dd 00:00:00.000')

    and the date returned by the date and time column is

    "2022-01-01 00:00:00.000".
    I also tried the other date column which is just the date and for that my adddays() expression was:

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

    Both are not working.

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @ysharma  You said '7 days prior to follow up date...' then use -7 not 7.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • Verified answer
    ysharma Profile Picture
    19 on at

    Hi @Hardesh15 ,
    Thank you for your reply. I think I will have to use 7 and not -7, cause I am adding days to utcnow (todays date) to be able to match the followup date on my dataset. Does that make sense?
    Also, as an update I was able to make it work.

     

    In my filter query I used the following code:

    ysharma_0-1637188420542.png

    The three expressions are:

     

    formatDateTime(outputs('Compose'),'yyyy');
    formatDateTime(outputs('Compose'),'MM')
    formatDateTime(outputs('Compose'),'dd')
    

     

     

    Thank you anyway. I hope this will help someone out.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard