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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate Array l...
Power Automate
Unanswered

Power Automate Array logic

(0) ShareShare
ReportReport
Posted on by 19

HI, I have an array in the below format and want to the get it in a table format. Using Power automate to send email as a tabular structure. 

Input format:

[
{
"Name": "User1",
"Category": "General",
"Hours": "32.0000000000000"
},
{
"Name": "User2",
"Category": "General",
"Hours": "8.00000000000000"
},
{
"Name": "User3",
"Category": "Stage 7 - Develop Project Tools & Templates",
"Hours": "3.00000000000000"
},
{
"Name": "User4",
"Category": "Stage 7 - Develop Project Tools & Templates",
"Hours": "3.00000000000000"
},
{
"Name": "User1",
"Category": "Stage 7 - Develop Project Tools & Templates",
"Hours": "4.00000000000000"
},
{
"Name": "User2",
"Category": "General",
"Hours": "5.00000000000000"
},
{
"Name": "User3",
"Category": "General",
"Hours": "5.00000000000000"
},
{
"Name": "User4",
"Category": "Stage 2 - Develop Draft Frameworks",
"Hours": "7.00000000000000"
}
]

------------------------

 

OutPut format:

 

UserNameCategoryTotalHours
User1General3.5
User1Stage 2 - Develop Draft Frameworks8
User1Stage 3 - Change Management Plan14.5
User1Stage 4 - Project Assurance Framework5.5
User1Stage 6 -Project Process Mapping10
User1Stage 7 - Develop Project Tools & Templates8.5
Total Hours50
User2General2.5
User2Stage 4 - Project Assurance Framework2
User2Stage 5 - Data Mapping - Define reporting criteria6.5
Total Hours11
User3Stage 2 - Develop Draft Frameworks38
User3Stage 6 - Project Process Mapping35
Total Hours73
User4General1
User4Stage 7 - Develop Project Tools & Templates15
Total Hours16

 

 

Need help in achieveing that output, Community please help

 

Thanks

SP

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,632 Super User 2026 Season 1 on at

    Use action "Create HTML table"

  • SP14 Profile Picture
    19 on at

    Hi Chriddle, 

    I have used HTML action however it is giving a table but inserting a row for each item in List. I want to consilidate for each user based on the category and count number of hours.

    SP14_0-1683237486580.png

     

    Thanks

  • Chriddle Profile Picture
    8,632 Super User 2026 Season 1 on at

    So your problem is not about creating a table, but restructuring/combining the object array.

    Let's summarize:

    You want to add all hours per user and category (I don't get why e.g. User2 | General adds up to 2.5, in general your input and the output table don't match), sort this by user and sum the total hours per user.

    Is this correct?

  • SP14 Profile Picture
    19 on at

    Hi Chriddle, 

    yeah that's true sort by the user, Get categroy and then hours associated to that category.

     

    In Tabular form

     

    Thanks

  • Chriddle Profile Picture
    8,632 Super User 2026 Season 1 on at

    Took some effort

    Chriddle_0-1683302764194.png

    Input of Apply to each User:

     

    sort(
    	union(
    		xpath(
    			xml(json(concat('{"root":{"User":', outputs('Users'),'}}'))),
    			'//Name/text()'
    		),
    		json('[]')
    	)
    )

     

    ProjectsByUser: Filter action

    From: @outputs('Users')

    Filter:

     

    @equals(item()['Name'], items('Apply_to_each_User'))

     

    ProjectsCombined: Select action

    From:

     

    sort(
    	union(
    		xpath(
    			xml(json(concat('{"root":{"ProjectName":', outputs('ProjectsByUser'),'}}'))),
    			'//Category/text()'
    		),
    		json('[]')
    	)
    )

     

    Map:

    {

    "Name": @{items('Apply_to_each_User')},

    "Category": @{item()},

    "Hours": seebelow

    }

     

    xpath(
    	xml(json(concat('{"root":{"User":', outputs('Users'),'}}'))),
    	concat('sum(//User[Name/text()="',items('Apply_to_each_User'),'" and Category/text()="', item(),'"]/Hours/text())')
    )

     

    Input of Apply to each Project@{body('ProjectsCombined')}

    Append to array variable

    Name: resultObject

    Value: @item()

    Append to array variable 2

    Name: resultObject

    Value:

     

    {"Name": "Total Hours", "Category": "", "Hours": @{xpath(
    	xml(json(concat('{"root":{"User":', outputs('Users'),'}}'))),
    	concat('sum(//User[Name/text()="',items('Apply_to_each_User'),'"]/Hours/text())')
    )}}

     

     

    Create HTML table Output:

    Name Category Hours
    User1General32
    User1Stage 7 - Develop Project Tools & Templates4
    Total Hours 36
    User2General13
    Total Hours 13
    User3General5
    User3Stage 7 - Develop Project Tools & Templates3
    Total Hours 8
    User4Stage 2 - Develop Draft Frameworks7
    User4Stage 7 - Develop Project Tools & Templates3
    Total Hours 10
     
     
  • SP14 Profile Picture
    19 on at

    Thanks for your input, I'll try to replicate the same at my end and let you know if I need any further assistance

     

    Thanks 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard