Hello Power Automate community !
I've having trouble with building a flow, I'm hoping one of you guys could help me.
I'm trying to group by an array by ID, year and month then sum the hours. (regardless of the client)
I've managed to group by ID and sum the hours, thanks to this tutorial : https://www.flyingpolymath.com/post/group-by-and-sum-in-power-automate
However, I can't seem to find how to nest multiple group by to achieve what I need.
Input array looks like this:
[
{
"id": "Country1",
"client": "Client1",
"year": 2021,
"month": 1,
"hours": 10
},
{
"id": "Country1",
"client": "Client1",
"year": 2021,
"month": 2,
"hours": 20
},
{
"id": "Country1",
"client": "Client2",
"year": 2021,
"month": 2,
"hours": 40
},
{
"id": "Country3",
"client": "Client1",
"year": 2020,
"month": 6,
"hours": 20
},
{
"id": "Country3",
"client": "Client2",
"year": 2020,
"month": 6,
"hours": 30
}
]
Output array should look something like this:
[
{
"id": "Country1",
"year": 2021,
"month": 1,
"hours": 10
},
{
"id": "Country1",
"year": 2021,
"month": 2,
"hours": 60
},
{
"id": "Country3",
"year": 2020,
"month": 6,
"hours": 50
}
]
Thank you to anyone who can point me towards the solution, I would be very grateful.
Elisabeth