cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
automaton
Level: Powered On

How to get unique column values from a SharePoint List in Microsoft Flow? (using Select rather than Apply_to_each.)

One of the questions I see coming up quite a bit is how to extract a list of distinct (unique) values from a SharePoint List column. This can be achieved using Select rather than the much more resource intensive loop approach via the Apply_to_each action, which I so often see suggested in forums.

 

Where you have 1000s of rows to retrieve and iterate through, it is easier and less intensive to get a column value from each row by using the Select statement to produce a basic array rather than standard JSON pairs.

 

A simple example of this is shown here:

  1. Get the list of items from the list.
  2. Select the values from the column you are interested in by turning off the standard map on the select statement and just inserting the value of the column you are interested in.
  3. Apply a union expression, with both operators being the output of the Select action, to make the list distinct. (this step is common across both methods).

 

Select and Union Example.pngSelect and union to form a distinct list of values.

Using this approach on large lists over the apply_to_each loop approach will make the flow run ridiculously quick in comparison.

3 REPLIES 3
Administrator
Administrator

Re: How to get unique column values from a SharePoint List in Microsoft Flow? (using Select rather than Apply_to_each.)

Awesome recipe, @automaton!!!

Thanks so much for your contribution!! 😁

Please come back and share ANYTIME! 

 

Cheers!

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!
jvdlinden
Level 8

Re: How to get unique column values from a SharePoint List in Microsoft Flow? (using Select rather than Apply_to_each.)

Wonderful. Thank you so much! Works like a charm.

 

MD
Level: Powered On

Re: How to get unique column values from a SharePoint List in Microsoft Flow? (using Select rather than Apply_to_each.)

@automaton so why you didn't show how to turn off the standard map on the select statement?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,275)