
Announcements
Hello,
Hope someone can help me with this.
I have a large SP List (SALES_DETAIL) with clients and sales of different products:
| ClientID | Brand | Amount_Sold |
| A1 | XX | 12 |
| A1 | FF | 4 |
| B1 | XX | 5 |
| B1 | ZZ | 6 |
Since this list is huge, >20.000 rows, when working in PowerApps, even with pre-filtering it takes some time to display data.
I need to have a secondary list, to just have the ClientID (retrieving unique values from SALES_DETAIL) and the sum of "Amount_Sold), for simpler display in PowerApps.
| ClientID | Total_Amount |
| A1 | 16 |
| B1 | 11 |
Tried several approaches using group and list view on a flow but can't get quite there.
Any help appreciated!
You just need one Select action (and xpath):
From:
union(
xpath(
xml(json(concat('{"root":{"item":', outputs('Data'),'}}'))),
'//ClientID/text()'
),
json('[]')
)Map:
ClientID
item()Amount
xpath(
xml(json(concat('{"root":{"item":', outputs('Data'),'}}'))),
concat('sum(//item[ClientID = ''',item(),''']/Amount_Sold)')
)
Result:
[
{
"ClientID": "A1",
"Amount": 16
},
{
"ClientID": "B1",
"Amount": 11
}
]