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

Expression help for a completed item 3 days before due date

Hello,

 

I am working on a flow where I am generating tables for team tasks based on due dates. 

So far I have the following expressions:

 

Past Due Items - 

@and(not(equals(item()['Status'], 'Completed')),
not(equals(item()['Owner'], 'Owner)),
not(equals(item()?['DueDateTime']?['DateTime'],Null)),
lessOrEquals(item()?['DueDateTime']?['DateTime'], addDays(utcNow(),0)))

 

Items Due This Week - 

@and(not(equals(item()['Status'], 'Completed')),
not(equals(item()['Owner'], 'Owner')),
not(equals(item()?['DueDateTime']?['DateTime'],Null)),
and(greater(item()?['DueDateTime']?['DateTime'],addDays(utcNow(),7)),
lessOrEquals(item()?['DueDateTime']?['DateTime'],addDays(utcNow(),14))))

 

I need to create another set of dates that have tasks completed ahead of time which means that they are in the "Completed" state but have been completed 3 days or more before the due date.

 

So far this is what I have - 

@and(not(equals(item()['Status'], 'NotStarted')),
not(equals(item()['Status'], 'InProgress')),
not(equals(item()['Status'], 'WaitingOnOthers')),
not(equals(item()['Owner'], 'Owner')),
not(equals(item()?['DueDateTime']?['DateTime'],Null)),
and(and(greater(item()?['DueDateTime']?['DateTime'], addDays(utcNow(),0)),
lessOrEquals(item()?['DueDateTime']?['DateTime'], addDays(utcNow(),7))),
less(item()?['LastModifiedDateTime'], item()?['DueDateTime']?['DateTime'])))

 

Any help would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Expression help for a completed item 3 days before due date

Hi @Allanmv ,

 

According to your description, it seems that you would like to filter out items that that are in the Completed status but have been completed 3 days or more before the due date.

 

I have made a simple flow for your reference.

 

Under the action List all tasks, add an action Filter array with the following code:

 

@and(equals(item()['Status'], 'Completed'),  lessorequals(item()?['CompletedDateTime']?['DateTime'],adddays(item()?['DueDateTime']?['DateTime'],-3)))

 

 

Add a simple Compose action to show the subject and the completed date and Due date for the filtered item.

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
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: Expression help for a completed item 3 days before due date

Hi @Allanmv ,

 

According to your description, it seems that you would like to filter out items that that are in the Completed status but have been completed 3 days or more before the due date.

 

I have made a simple flow for your reference.

 

Under the action List all tasks, add an action Filter array with the following code:

 

@and(equals(item()['Status'], 'Completed'),  lessorequals(item()?['CompletedDateTime']?['DateTime'],adddays(item()?['DueDateTime']?['DateTime'],-3)))

 

 

Add a simple Compose action to show the subject and the completed date and Due date for the filtered item.

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
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 (Last 30 Days)
Users online (4,927)