Get count of unique records in Power Automate (Dynamics Customer Engagement)
Recently, I got a requirement in which I had to get the distinct count of records(from a custom table) associated with Appointment. To achieve this I wanted to go with the flow but since I recently have started working on Flow/ Power Automate, I had very little idea how to achieve this and hence I am adding the steps here which you can also follow to get this. Step 1: Choose the trigger point Step 2: Get the list of records for which you want count of distinct value Step 3: Initialize a variable of type array Step 4: Add action 'Apply to each', here I am adding all Guids in array which we declared in last step Step 5: Add a 'Compose' data operation, here we will add only unique Guids from the above list collected: union(variables('AccountsArray'),variables('AccountsArray')) Step 6: In the final step we just need to count the records of unique Guids stored in the last step. length(outputs('Compose')) Combined screenshot fyr: