cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
steve19
Level: Power Up

Count of rows between two dynamic dates

Hi all,

 

I am trying to create a flow which will pull records between two yesterdays and todays date and perform a count on how many rows appear. I am trying to use the time expressions, but it either produces a timeout or error. Any tips or suggestions would be great! Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Count of rows between two dynamic dates

Hi @steve19,

 

Could you please share a screenshot of your flow’s configuration?

Could you please show a bit more about your time expression?

Further, where do you pull records between yesterday and today?

 

I have made a test on my side and pull records between yesterday and today from a SharePoint list. Besides, I suppose that there is a date column within your data source which is used to compare with yesterday’s date and today’s date.

 

Please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Compose action (Rename it as Date of Today), Inputs set to following formula:
utcNow()
  • Add a Compose 2 action (Rename it as Date of Yesterday), Inputs set to following formula:
addDays(utcNow(),-1)
  • Add a “Get items” action, specify Site Address and List Name.
  • Add a “Filter array” action, From set to output of “Get items” action, click “Edit in advanced mode”, type the following formula:
@and(greaterOrEquals(formatDateTime(item()?['Created'], 'MM/dd/yyyy'), formatDateTime(outputs('Date_of_Yesterday'), 'MM/dd/yyyy')),lessOrEquals(formatDateTime(item()?['Created'], 'MM/dd/yyyy'), formatDateTime(outputs('Date_of_Today'), 'MM/dd/yyyy')))
  • Add a Compose 3 action, Inputs set to following formula:
length(body('Filter_array'))
  • Add a “Send an email” action, Body set to output of above Compose 3 action.

Note: I suppose that you could get the two dynamic dates (Yoday's date and yesterday's date) on your side, the Date of Today action and Date of Yesterday action return the two dynamic dates on my side.

 

Image reference:6.JPG

The flow works successfully as below:7.JPG

 

8.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Count of rows between two dynamic dates

Hi @steve19,

 

Could you please share a screenshot of your flow’s configuration?

Could you please show a bit more about your time expression?

Further, where do you pull records between yesterday and today?

 

I have made a test on my side and pull records between yesterday and today from a SharePoint list. Besides, I suppose that there is a date column within your data source which is used to compare with yesterday’s date and today’s date.

 

Please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Compose action (Rename it as Date of Today), Inputs set to following formula:
utcNow()
  • Add a Compose 2 action (Rename it as Date of Yesterday), Inputs set to following formula:
addDays(utcNow(),-1)
  • Add a “Get items” action, specify Site Address and List Name.
  • Add a “Filter array” action, From set to output of “Get items” action, click “Edit in advanced mode”, type the following formula:
@and(greaterOrEquals(formatDateTime(item()?['Created'], 'MM/dd/yyyy'), formatDateTime(outputs('Date_of_Yesterday'), 'MM/dd/yyyy')),lessOrEquals(formatDateTime(item()?['Created'], 'MM/dd/yyyy'), formatDateTime(outputs('Date_of_Today'), 'MM/dd/yyyy')))
  • Add a Compose 3 action, Inputs set to following formula:
length(body('Filter_array'))
  • Add a “Send an email” action, Body set to output of above Compose 3 action.

Note: I suppose that you could get the two dynamic dates (Yoday's date and yesterday's date) on your side, the Date of Today action and Date of Yesterday action return the two dynamic dates on my side.

 

Image reference:6.JPG

The flow works successfully as below:7.JPG

 

8.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 439 members 6,663 guests
Please welcome our newest community members: