Contents

Get Distinct Records using the union expression in Power Automate

Contents

If you want to find all the distinct records in your data-source like a SharePoint list, there is no “Distinct records” action or distinct expression that you can use in Power Automate (earlier called Microsoft Flow) .

There is a simple way to do it using the union expression . This expression returns all the common items in two arrays. So, if we you use the union expression for an array on itself , it will return basically all the items, but the items that are there multiple times will be returned only once. Voila! You just found out the lookalike of ‘Distinct’ function in Power Apps.

Here is a screenshot of a simple flow with an array [1,2,4,1] and the compose action with the union expression -

/uploads/2020/04/image.png?w=869

Here is the expression I used.

union(variables('array1'),variables('array1'))

/uploads/2020/04/image-1.png?w=435

If you have any questions, please let me know in the comments.


Ganesh -

Hi, I am trying to compare two records from two different CDS entities as below. I have mentioned the below contract numbers just for example and not the actual which I am using in my Power Automate. I need to compare PPR Contract with STEP Contract and delete from PPR Contract whichever is not available in STEP Contract. in the below scenario Contracts 121 and 122 are not available in STEP Contract and has to be deleted in PPR Contract. 1. STEP Contract Entity - Contract Number (Column) 123 124 125 2. PPR Contract Entity - Contract Number (Column) 123 124 125 121 122 This is how I started designing the flow but I am stuck in the Apply for each and filtering the array 1. Declaring an array variable to store STEP Contract 2. Declaring an array variable to store PPR Contract 3. Declaring an array variable to store PPR Contract records to be deleted after comparison 4. Apply to each loop in PPR Contract and inside that filter array for STEP contracts where PPR Contracts contract numbers are NOT IN STEP Contracts 5. Add a null check condition for the above filter 6. If yes, then add that item from PPR Contracts array where we need to delete the records 7. Perform the deletion. I am stuck in point 4 where I am not getting the expected filter results. In this case it should filter 121 and 122. Unfortunately, I am unable to share the screenshot here. Please advise me on the same.


#### [Ayushi Porwal]( "[email protected]") -

I need to make a schedule flow for sharepoint list in which one or two people make changes in list and the email should go to one supervisor or their supervisor as one mail instead of many mail


Did this article help you❓

Subscribe to get more Power Platform articles directly in your inbox