Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

Get unique users from various people picker columns (Power Automate)

Posted on June 1, 2022June 1, 2022 by Tom

“I am able to get unique value for single column in Power Automate, how to approach if we have more people picker columns and we need unique values?”


When you send reminders or reports using Power Automate flow, it’s a good practice to send as few emails as possible. If a user should know about 5 SharePoint items, you don’t want to send him 5 emails. You want to include all of them in a single one. But what if there’s not only 1 people picker column? Would you repeat the same process for each column separately? Send one email per column? Or would it be better to include all their items in a single email?

Get the unique values across the columns

In the original article you had only 1 people picker column. You extracted all the email addresses using the ‘Select’ action, and searched for the unique values using the union(…) expression.

Note: make sure that you switch to the ‘Text mode’ in the ‘Select’ action as that’s a very common mistake!

If you’ve got more than 1 people picker column, you’ll need the ‘Select’ action for each of them. For example, to get unique emails from Approver, Created By and Modified By columns.

Power Automate unique more people columns

You’ll have 3 outputs from the ‘Select’ actions, that’s 3 arrays with email addresses.

Since these are arrays, you can combine them together AND filter unique values using the union(…) expression. If you have just a single array, you use the same array twice to get the unique values. But this time you’ve got more arrays so you can use all of them – there’s no need to repeat.

union(body('Select'),body('Select_2'),body('Select_3'))
Power Automate unique more people columns

The result will be a single array that’ll contain only the unique emails among all the columns.

Find the corresponding items

Now, when you’ve got all the unique emails, it’s time for the loop. Find the items for each of the unique addresses, one by one.

But again, this time you’re not looking in a single SP column. You’re looking in more of them, and as such the filter will be more complex. You’ll need a combined filter that’ll check if the email address is in the Approval, Created By, or Modified By column. Use an extra ‘Filter array’ action to help you build the filter.

Create the filters one by one and put them all inside @or(…) operator, e.g.

@or(equals(item()?['ApproverSingle/Email'], items('Apply_to_each')),equals(item()?['Author/Email'], items('Apply_to_each')),equals(item()?['Editor/Email'], items('Apply_to_each')))

You’ll get only the items for the currently processed user which you can put into HTML table and send in an email.

Power Automate unique more people columns

Summary

There’s a bit of a difference between a Power Automate flow processing unique users in a single people picker or more people picker columns, but the approach is still the same. Firstly, extract only the relevant property – the email addresses in this case. Since there’re more columns you’ll need more ‘Select’ actions. Secondly, take all the emails, merge them together and extract duplicate values. And thirdly, since the emails can be in more columns, you must check all the columns in the filter.

All that’s left is to send the filtered items to the users, one email for each of them.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme