This should be simple but I just can't get around it.
I have an array that lists a bunch of users' departments. Only the department names, so it looks like:
Human Resources |
Finance |
Operations |
Human Resources |
etc.
Naturally there are duplicates, since some users in this list are from the same department.
I want to count the duplicates.
Basically I want a final list like:
12 users from: Human Resources
1 user from: Operations
2 Users from: Logistics
Solved! Go to Solution.
@SylvieLet17 try this flow, very simple. Produces this output, but can easily be adjusted to be formed however you like:
[
{
"Department": "HR",
"Count": 12
},
{
"Department": "Ops",
"Count": 1
},
{
"Department": "Logistics",
"Count": 2
}
]
Fewer steps so less complicated https://ibb.co/54KZH4R (Easier to view on link):
Code for the append to results for you to copy and paste is:
{
"Department": @{item()},
"Count":@{length(body('Filter_array'))}
}
See how you get on.
Please...
If I answered your question Accept it as a solution ✔️
If I helped you out, please give me some Kudos 👍
Thanks 😙
Thanks @krootz, I replicated your flow, but it seems to be timing out on the Each Dept action, with only 20 items in the array to loop through.
@SylvieLet17 try this flow, very simple. Produces this output, but can easily be adjusted to be formed however you like:
[
{
"Department": "HR",
"Count": 12
},
{
"Department": "Ops",
"Count": 1
},
{
"Department": "Logistics",
"Count": 2
}
]
Fewer steps so less complicated https://ibb.co/54KZH4R (Easier to view on link):
Code for the append to results for you to copy and paste is:
{
"Department": @{item()},
"Count":@{length(body('Filter_array'))}
}
See how you get on.
Please...
If I answered your question Accept it as a solution ✔️
If I helped you out, please give me some Kudos 👍
Thanks 😙
@krootz thank you. You have been making some really neat solutions. Have learned quite a bit from your posts.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
At the monthly call, connect with other leaders and find out how community makes your experience even better.
User | Count |
---|---|
24 | |
24 | |
23 | |
21 | |
17 |
User | Count |
---|---|
55 | |
39 | |
37 | |
30 | |
28 |