I have below Array in Power Automate:
{
"body": {
"name": "vAnswersArray",
"type": "Array",
"value": [
{
"Index": 0,
"Title": "AC-01",
"Answer": "test ac01 a"
},
{
"Index": 1,
"Title": "AC-02",
"Answer": "test ac02 a"
},
{
"Index": 2,
"Title": "AC-03",
"Answer": "test ac03 a"
},
{
"Index": 3,
"Title": "AC-04",
"Answer": "test ac04 a"
},
{
"Index": 4,
"Title": "AC-01",
"Answer": "test ac01 b"
},
{
"Index": 5,
"Title": "AC-03",
"Answer": "test ac03 b"
}
]
}
}
My question is, I want to Group by on Title column and concatenate text in Answer column, so how to get below output:
"value": [
{
"Index": 0,
"Title": "AC-01",
"Answer": "test ac01 a \n test ac01 b"
},
{
"Index": 1,
"Title": "AC-02",
"Answer": "test ac02 a"
},
{
"Index": 2,
"Title": "AC-03",
"Answer": "test ac03 a \n test ac03 b"
},
{
"Index": 3,
"Title": "AC-04",
"Answer": "test ac04 a"
}
]
Index column need not come in output. I appreciate all answers, Thanks.

Raghunath BhukanPosted Jan 16, 2026, 3:33 AM
Hi, you can do it multiple ways.
Solution 1 -
Step 1: Initialize variables
Initialize an Array variable
Name:
GroupedArrayValue:
[]Initialize a String variable
Name:
AnswerTextValue: empty
Step 2: Get distinct Titles
Add a Compose action called
DistinctTitlesand use this expression:This gives you a unique list of Titles.
Step 3: Apply to each Title
Add Apply to each
Input:
outputs('DistinctTitles')Inside the loop:
Step 4: Filter array by Title
Add Filter array
From:
variables('vAnswersArray')Condition:
Step 5: Build concatenated Answer text
Add Compose action called
CombinedAnswerswith this expression:This joins all matching answers with a new line.
Step 6: Append grouped result
Add Append to array variable
Variable:
GroupedArrayValue:
Final Output (
GroupedArray)Final output with Grouped by
Title,Answers concatenated, Index removed, Order preserved based on first occurrenceSolution 2-
Below is the fastest-performance solution in Power Automate.
It is optimized for large arrays, uses one pass over the data, and avoids nested
filter()calls (which are slow).Fastest approach (single-pass dictionary build + projection)
Use ONE Compose action with the expression below.
Then add ONE more Compose before it named
BuildDictionary:That’s it — two Composes total, no loops, no filters.
Final output
Why this is the fastest possible solution
reduce()loops once over the array (O(n))Data is stored in a dictionary (hash lookup, O(1))
No nested
filter()orselect()inside loopsNo variables or Apply to each
Memory efficient and scalable
Thanks.