This flow combines "Master" and "Results", sort this new array and then identifies and filters out records from Master that are also present in Results.

Master
Spoiler (Highlight to read)
[
{
"app": "app1",
"sub_app": "sub_app1"
},
{
"app": "app1",
"sub_app": "sub_app2"
},
{
"app": "app1",
"sub_app": "sub_app3"
},
{
"app": "app2",
"sub_app": "sub_app4"
},
{
"app": "app2",
"sub_app": "sub_app5"
},
{
"app": "app3",
"sub_app": "sub_app6"
},
{
"app": "app3",
"sub_app": "sub_app7"
}
]
[
{
"app": "app1",
"sub_app": "sub_app1"
},
{
"app": "app1",
"sub_app": "sub_app2"
},
{
"app": "app1",
"sub_app": "sub_app3"
},
{
"app": "app2",
"sub_app": "sub_app4"
},
{
"app": "app2",
"sub_app": "sub_app5"
},
{
"app": "app3",
"sub_app": "sub_app6"
},
{
"app": "app3",
"sub_app": "sub_app7"
}
]
Result
Spoiler (Highlight to read)
[
{
"app": "app1",
"sub_app": "sub_app1",
"col_x": "xx",
"col_y": "yy"
},
{
"app": "app1",
"sub_app": "sub_app2",
"col_x": "xxx",
"col_y": "yyy"
},
{
"app": "app1",
"sub_app": "sub_app3",
"col_x": "xx",
"col_y": "yyy"
},
{
"app": "app3",
"sub_app": "sub_app6",
"col_x": "x",
"col_y": "y"
},
{
"app": "app1",
"sub_app": "sub_app1",
"col_x": "xx2",
"col_y": "yy2"
}
]
[
{
"app": "app1",
"sub_app": "sub_app1",
"col_x": "xx",
"col_y": "yy"
},
{
"app": "app1",
"sub_app": "sub_app2",
"col_x": "xxx",
"col_y": "yyy"
},
{
"app": "app1",
"sub_app": "sub_app3",
"col_x": "xx",
"col_y": "yyy"
},
{
"app": "app3",
"sub_app": "sub_app6",
"col_x": "x",
"col_y": "y"
},
{
"app": "app1",
"sub_app": "sub_app1",
"col_x": "xx2",
"col_y": "yy2"
}
]
CommbinedWithSortKey (Select)
From
union(outputs('Master'), outputs('Result'))
Map Item
item()
Map SortKey
concat(item()['app'], decodeUriComponent('%0A'), item()['sub_app'])
SortedCombined (Compose)
sort(body('CombinedWithSortKey'), 'SortKey')
MarkedItems (Select)
From
range(0, length(outputs('SortedCombined')))
Map app
outputs('SortedCombined')[item()]['Item']['app']
Map sub_app
outputs('SortedCombined')[item()]['Item']['sub_app']
Map col_x
if(
less(
item(),
sub(length(outputs('SortedCombined')), 1)
),
if(
equals(
outputs('SortedCombined')[item()]['Item']?['col_x'],
null
),
if(
and(
equals(
outputs('SortedCombined')[item()]['Item']['app'],
outputs('SortedCombined')[add(item(), 1)]['Item']['app']
),
equals(
outputs('SortedCombined')[item()]['Item']['sub_app'],
outputs('SortedCombined')[add(item(), 1)]['Item']['sub_app']
)
),
'deleteme',
outputs('SortedCombined')[item()]['Item']?['col_x']
),
outputs('SortedCombined')[item()]['Item']?['col_x']
),
outputs('SortedCombined')[item()]['Item']?['col_x']
)
Map col_y
outputs('SortedCombined')[item()]['Item']?['col_y']
FilteredItems (Filter array)
From
body('MarkedItems')
Filter
@not(equals(item()['col_x'], 'deleteme'))
Output table:
app sub_app col_x col_y
app1 sub_app1 xx yy
app1 sub_app1 xx2 yy2
app1 sub_app2 xxx yyy
app1 sub_app3
app2 sub_app3 xx yyy
app2 sub_app4
app2 sub_app5
app3 sub_app4 x y
app3 sub_app6
app3 sub_app7