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

Get a Count of Open and Completed Tasks In Planner

My goal is to get a count of the number of Open and Completed Tasks in a Planner plan. With those numbers it will update a SharePoint list so I have an overview of the project progress.

 

I cant seem to find an easy way to do this, screenshots are of a way to get the the numbers out of the plan

 

PinVin_1-1642429372533.pngPinVin_2-1642429385151.png

 

The results only come back with the total number of tasks in the plan regardless of their complete percentage. Can anyone help?

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @PinVin,

 

You can avoid the loop by using the array outside of the apply to each. And use a length function to count the number of items.

 

Below is an example of that approach.

 

You can use this expression for Closed Tasks:

 

length(body('Filter_array_-_Closed_Tasks'))

 

 

You can use this expression for Open Tasks. In this expression I subtract the number of Closed Tasks from the total of number of tasks to get the open tasks.

 

sub(length(outputs('List_tasks')?['body/value']),length(body('Filter_array_-_Closed_Tasks')))

 

 

 

 

openclosedtasks.png

View solution in original post

2 REPLIES 2
Expiscornovus
Dual Super User
Dual Super User

Hi @PinVin,

 

You can avoid the loop by using the array outside of the apply to each. And use a length function to count the number of items.

 

Below is an example of that approach.

 

You can use this expression for Closed Tasks:

 

length(body('Filter_array_-_Closed_Tasks'))

 

 

You can use this expression for Open Tasks. In this expression I subtract the number of Closed Tasks from the total of number of tasks to get the open tasks.

 

sub(length(outputs('List_tasks')?['body/value']),length(body('Filter_array_-_Closed_Tasks')))

 

 

 

 

openclosedtasks.png

PinVin
New Member

@Expiscornovus 

Worked a treat, absolute legend!

 

Many thanks

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (2,203)