web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to create a monthl...
Power Automate
Unanswered

How to create a monthly summary table from sharepoint list?

(0) ShareShare
ReportReport
Posted on by 14

In my Sharepoint, I have an issue tracker (see image 1). It includes a list of issues from different departments along with their status. I want to send my leadership a pivot table-style report each month detailing the amount of this issue for each department and its status (see image 2). Is there a way to use power automate to execute this action? I tried a few techniques utilizing the Create HTML action, but they didn't work for me.

psrini20_0-1689389765480.png

 NewIn ProgressCompletedTotal
Department 13339
Department 23339
Department 33339
Total99927
Categories:
I have the same question (0)
  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @psrini20 

     

    I tried creating a flow which will help you. In the sample flow, I have created a SharePoint list 'HelpDeskTickets' with two columns 'Department' (single line of text) and 'Status' (choice) fields:

    ManishSolanki_0-1689412603248.png

     

    Here is the flow:

    1. Firstly, we will create a recurrence flow and set the frequency for it:

    ManishSolanki_1-1689412751652.png

     

    You may choose different trigger point as per your need.

     

    2. Next, we will initialize 4 variables to store the values of Department, count for New/In progress/Completed tickets count:

    ManishSolanki_2-1689412867030.png

    ManishSolanki_3-1689412899176.png

     

    3. Now, we will fetch the records or list items from SharePoint list using 'Get items' action:

    ManishSolanki_4-1689412993458.png

    You may write filter query to fetch past month data and so on.

     

    4. We will use 'Select' action to get the value of Department field in a collection from the output of 'Get items' action. Click on 'Switch to text mode' and select Department field from Dynamic content window:

    ManishSolanki_5-1689413328985.png

     

    5. We will find the distinct Department using union() formula and then iterate the distinct Department items using 'Apply to each' action:

    ManishSolanki_6-1689413668232.png

    Expression used in above screenshot:

    union(body('Select'),body('Select'))

    We will store the value of each iterated department in 'Compose' action using expression as shown below:

    ManishSolanki_7-1689413879266.png

     

    Expression used in above screenshot:

    item()

     

    Continue inside 'Apply to each', now add 3 parallel action. In each action, we will count the no of tickets for each category (New, In progress & Completed) and overall total count for each category:

    ManishSolanki_8-1689414065707.png

     

    Branch 1 (New):

    Using 'Filter array' action, we will filter the records on the basis of Department & status. Additionally, we will update the overall count variable for New tickets category:

    ManishSolanki_9-1689414269176.png

    To add filter expression, click on 'Edit on advanced mode' link at the bottom & add the below expression:

    @and(equals(item()?['Department'], outputs('Compose')),equals(item()?['Status/Value'],'New'))

     Update the overall New category ticket count using 'Increment variable'  action:

    ManishSolanki_10-1689414482753.png

    Expression used for finding the count is:

    length(body('Filter_array'))

     

    Branch 2 (In Progress):

    Using 'Filter array' action, we will filter the records on the basis of Department & status. Additionally, we will update the overall count variable for 'In progress' tickets category:

    ManishSolanki_11-1689414640849.png

     

    To add filter expression, click on 'Edit on advanced mode' link at the bottom & add the below expression:

    @and(equals(item()?['Department'], outputs('Compose')),equals(item()?['Status/Value'],'In progress'))

     Update the overall 'In Progress' category ticket count using 'Increment variable'  action:

    ManishSolanki_12-1689414701162.png

    Expression used for finding the count is:

    length(body('Filter_array_2'))

     

    Branch 3 (Completed):

     

    Using 'Filter array' action, we will filter the records on the basis of Department & status. Additionally, we will update the overall count variable for Completed tickets category:

    ManishSolanki_13-1689414766942.png

    To add filter expression, click on 'Edit on advanced mode' link at the bottom & add the below expression:

    @and(equals(item()?['Department'], outputs('Compose')),equals(item()?['Status/Value'],'Completed'))

     Update the overall Completed category ticket count using 'Increment variable'  action:

    ManishSolanki_14-1689414821971.png

    Expression used for finding the count is:

    length(body('Filter_array_3'))

     

    Inside 'Apply to each' action, now add 'Append to array' action to save the record for each department:

    ManishSolanki_15-1689414942517.png

    Following expression is added inside 'Append to array variable' action:

    {
    "Department": @{outputs('Compose')},
    "New": @{length(body('Filter_array'))},
    "InProgress": @{length(body('Filter_array_2'))},
    "Completed": @{length(body('Filter_array_3'))}
    }

    you may just copy & paste the above expression in your flow.

     

    The structure of 'Apply to each' action will look like this:

    ManishSolanki_16-1689415139530.png

     

     

    6. After closing 'Apply to each' action, we will update the overall counts for all categories and append to the array. This action should be called outside the 'Apply to each' action:

    ManishSolanki_17-1689415249466.png

     

    Expression used in above screenshot is:

    {
    "Department": "Total",
    "New": @{variables('varNewTicketCount')},
    "InProgress": @{variables('varInProgressTicketCount')},
    "Completed": @{variables('varCompletedCount')}
    }

     

    7. Finally, we will create an html table from the DepartmentStats variable using 'Create HTML table' action:

    ManishSolanki_18-1689415569494.png

    Expression used for each header is mentioned below:

    (blank): item()?['Department']

    New: item()?['New']

    InProgress: item()?['InProgress']

    Completed: item()?['Completed']

    Total: add(add(item()?['New'],item()?['InProgress']),item()?['Completed'])

     

    You can send the output of 'Create html table' action in the email body as required.

     

    Here is the output generated by this flow:

    ManishSolanki_19-1689415874451.png

     

     

    I know the above flow is lengthy but this will give you some idea in designing the flow as per the requirement 🙂

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    Good one @ManishSolanki , I was about to post my solution but you beat me to it.

    I used a SharePoint view to group the list items by Department and Status.

    That saves me from calculating totals in Power Automate. I'll blog my solution 🙂 now that you have this one covered.

     

  • psrini20 Profile Picture
    14 on at

    Hi @ManishSolanki , Thank you so much. It is fantastic, I got the result from my flow.

    Hi @SudeepGhatakNZ , For the academic interest, can you please let me know how to get the result by sharepoint virew?

  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    Sure, here it is.

    Group by Count in Power Automate - Powering your Apps (sudeepghatak.com)

     

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @SudeepGhatakNZ 

     

    Awesome! its a new learning experience. Thanks again for sharing such a cool stuff 🙂 

     

    Thanks & regards,

    Manish Solanki

  • WhiskeyClone Profile Picture
    8 on at
     
    Apologies for piggy backing off of an old post and I'm not sure whether you even still have this automation in place, but I'm trying to achieve the same thing - creating what is essentially a pivot table from SharePoint list data -  but am having trouble.  I've setup a test SP list/automation and followed the steps that you posted as best as I can (Some of the images no longer show) but every time I'm still getting empty outputs in my filter array actions and can't see where I'm going wrong! Can I just clarify which dynamic content should be in the 'From' field of the Filter Array action?
     
     
     
    Update 20/02 - Nevermind, I've figured it out. I'd mistyped one of my fieldnames in my filter array condition which was throwing me off! After I'd corrected that everything worked perfectly - thank you for such a great guide!
     
     
    Thankyou!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard