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 / Merge two rows in Powe...
Power Automate
Answered

Merge two rows in Power Automate

(0) ShareShare
ReportReport
Posted on by 65

I am having following array:

[
{
"Parameter": "A",
"I-1": "20",
"C-1": "30"
},
{
"Parameter": "A",
"I-2": "50",
"C-2": "30"
},
{
"Parameter": "B",
"I-2": "50",
"C-2": "80"
}
]

 

I have used following flow:

 

svivek_0-1669124753553.png

svivek_1-1669124796058.png

 

I am getting final result as:

 

svivek_2-1669124865358.png

 

However my requirement is below table. Kindly let me know if below result in form of table can be achieved.

 

svivek_3-1669125024293.png

 

 

 

Categories:
  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @svivek  please follow below steps to achieve desired output:

     

    1. Add Compose action below the current Compose action you have as follows:

    annajhaveri_0-1669202513317.png

     

    2. Add another compose action and use following expression, rename it as XML

    xml(variables('Array'))

    annajhaveri_1-1669202544988.png

     

    3. Your select action should be configured as follows, here i am using array as input, you can use the first compose action outputs as you have used it already

    annajhaveri_2-1669202567302.png

    The expressions should be as follows for i-1,i-2,c-1,c-2

    xpath(outputs('XML'), concat('//Array[Parameter/text()="', item()['Parameter'], '"]/I-1/text()'))?[0]
    xpath(outputs('XML'), concat('//Array[Parameter/text()="', item()['Parameter'], '"]/C-1/text()'))?[0]
    xpath(outputs('XML'), concat('//Array[Parameter/text()="', item()['Parameter'], '"]/I-2/text()'))?[0]
    xpath(outputs('XML'), concat('//Array[Parameter/text()="', item()['Parameter'], '"]/C-2/text()'))?[0]

     

    4. Add one more compose action after select and it should be as follows:

    annajhaveri_3-1669202689606.png

     

    5. Add one more compose action and it should use following expression

    union(body('Select'),outputs('Compose_3'))

     

    6. In Create HTML table action use output of the last compose action you have added.

  • svivek Profile Picture
    65 on at

    @annajhaveri ,

    I tried above solution :  {"Root":"Array":outputs('Compose')}}

    However, it is showing an error:  "Enter a valid json."

     

    Kindly advice.

     

    svivek_0-1674471343482.png

     

  • Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at

    There is missing a {

     {"Root":{"Array":[1,2,3]}}
  • svivek Profile Picture
    65 on at

    @annajhaveri 

    I tried above mentioned solution and it is working well.

    Only one query is that is it possible to display "Null" wherever no output generated (refer below screenshots for details)

     

    svivek_0-1674544104609.png

    svivek_1-1674544135937.png

     

     

     

  • Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at

    If you have followed @annajhaveri's suggestion you can add another select after the select with following expression for "I-1" etc.:

     

     

     

    if(
     equals(
     item()['I-1'],
     null
     ),
     'Null',
     item()['I-1']
    )

     

     

     

    Same for the other properties.

    Maybe you have to check for '' instead of null.

     

    And of course you can merge these both selects but it makes the needed expression a bit cluttered.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard