cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (4,589)