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!