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
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.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (2,149)