Get Distinct Count Of SharePoint List Items Using Power Automate

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.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 
Below is the overall structure of the flow. Now, let me explain each step in detail.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 
Step 1
 
Manually Trigger a flow.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 
Step 2
 
Add an action, “Get Items”.
 
Add SharePoint Site Address and List Name.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 
Step 3
 
Initialize a variable named “ProjectArray”.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 
Step 4
 
Add an action, “Append to array variable”.
 
Select Variable and add ProjectName in the Value section.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 
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.
  1. union(variables('ProjectArray'),variables('ProjectArray'))   
Get Distinct Count From SharePoint List Item Using Power Automate
 
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.
  1. length(outputs('Compose'))   
Get Distinct Count From SharePoint List Item Using Power Automate
 
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.
 
Get Distinct Count From SharePoint List Item Using Power Automate
 

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!!

Similar Articles