How to count distinct Items in an Array in #PowerAutomate without using an Apply to Each loop

preview_player
Показать описание
In this video I demonstrate how you can count the number of distinct items in a Power Automate array without having to use an Apply to Each loop for maximum performance. This is another demonstrations of the powerful xpath expression. Response to Power Automate Community Question:
Рекомендации по теме
Комментарии
Автор

omg, thank you so much. I've been beating my head against the wall over and over for the past 3 days on this.

voodoomanclothingco.
Автор

Another winner! Really need to spend more time with xml()... Thanks again!

ricardobunge
Автор

Yes! This did exactly what I needed! Thank you much, Paulie!

csjo
Автор

Thanks a lot Paulie!
I´ve been using the Xpath Expression because of you! It definitely speeds up the flows and the best part is that it also reduces the API calls.

yeraldo
Автор

Used this in a logic app and it worked like magic 👍

NonhleFMdlalose
Автор

Thanks a lot! I have been looking for this answer for 1 week and nothing worked except for this option. Please, if you have the same example using an Apply to Each loop, I would like to check it. Thanks again.

mgmind
Автор

Man, you just saved my life, thank you very much for this great tutorial

josemanuelimbachivarela
Автор

Hi Paulie,

Brilliant thanks for this and good timing. I do need to do a mass delete of records in the Teams Table. Unfortunately our IT have locked access to the HTTP action.

So I was going to leverage an earlier solution of your which uses Threads. I was going to run the Threads concurrently and the first thread would process rows 1 - 5000, the second thread 5001 - 1000 as so one. Within each thread there would be the 'apply to each' to 'delete row', which again would run concurrently maxing out a 50.

My issue is that I do not know how to select rows 1 - 5000, 5001 - 1000 etc of a Teams Table. With a SharePoint list I can use the ID column. In the Teams Table I have created an AutoNumber column but this is saved as a text. I'm guessing a solution might involve 'Fetch XML Query' in the 'List Rows' action?

Appreciate any suggestion?

ajambo
Автор

Please teach.
I’d like to use this with number.
I put the word bellow in the count column
{ length(xpath(outputs(‘XML’), concat(‘//Array[ID/number() = ‘, item(), ‘]’))) }. But didn’t work.
What should I do?

ayakosekino
Автор

I am trying to create a column that counts each individual item from the item column. What do I need to change in the flow?

Item Count
A 1
A 2
A 3
B 1
B 2
A 4

DataisKing
Автор

How can I count from share point by text
Ex. Column includes "Done" & " "Not Yet"

how can I get in summarise table the count of each

rasmimatta
Автор

I'm getting an error.
This is my simple array:
<Root>
<Array>STOCK ITEM 45</Array>
<Array>STOCK ITEM 45</Array>
<Array>STOCK ITEM 45</Array>
<Array>CUSTOM ITEM 582</Array>
<Array>CUSTOM ITEM 582</Array>
<Array>CUSTOM ITEM 582</Array>
<Array>CUSTOM ITEM 582</Array>
</Root>

Working XPATH:
//Array[text()="STOCK ITEM 45"]

Expression, using the format in your example:
length(xpath(outputs('XML'), concat('//Array[text()="', item(), '"]')))

Error:
The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '{

Sammyc