Introduction
In this article, we will see how to get a distinct count of SharePoint list items based on a specific column using Power Automate or Microsoft Flow.
Real-Life Business Use Case
Please refer to the below screenshot. Here, we need to retrieve distinct Project Count from the list below using Power Automate.

Below is the overall structure of the flow. Now, let me explain each step in detail.

Step 1. Manually Trigger a flow.

Step 2. Add an action, “Get Items”.
Add SharePoint Site Address and List Name.

Step 3. Initialize a variable named “ProjectArray”.

Step 4. Add an action, “Append to array variable”.
Select Variable and add ProjectName in the Value section.

Step 5. Add action, Compose.
Add the following formula. This is a very important step. We need to use a union function where we need to add the following formula.
union(variables('ProjectArray'), variables('ProjectArray'))

We can get Distinct records using Union expression inside Power Automate.
Step 6. Now, we need to find the length of the values returned in the above stage.
length(outputs('Compose'))

Now, let’s run a test of the flow!
Here, is the test of the flow. As we can see here, there were a total of 5 counts.

Conclusion
This is how we can find the distinct count from the SharePoint list for the Project ID. I hope this is clear now. Stay connected with me for more amazing Power Platform articles!
Happy Power Automating!

Kavya MuniswamappaPosted Jan 19, 2023, 8:30 AM
Hi Dhruvin, Thanks for this helpful explanation. I have a requirement to count the number of projects in group. Example in your case, I need to get count 3 for SMP. Would you help me out kindly in this!
Smin kPosted May 20, 2021, 7:45 PM
Hi! Very helpful. In a similar flow, I would like to send an email to a list of contacts who might appear more than once in the list. How do ensure that I send only one email out to each unique contact on the list and avoid sending multiple emails to the same contacts?