Distinct Powerapps Function
The Distinct powerapps function is used to return a unique list of values from a data source based on a specified column. This function is particularly useful when you want to retrieve a list of unique values from a column in a data source, and you don't want to display duplicate values. Power Apps Syntax Distinct(dataSource, columnName)
The dataSource argument specifies the data source from which to retrieve the values, and the columnName argument specifies the column from which to retrieve the values.
The Distinct function evaluates a formula across each record of a table and returns a one-column table of the results with duplicate values removed. The name of the column is Value.
Example: Step 1: Insert a Button control in the Power Apps studio.
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-01.webp)
Step 2: Set the Text property of button to the Create Collection.
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-02.webp)
Step 3: Set button control's OnSelect property to the below formula:
Power Apps Formula
{Name: "Ashish", Country: "India", Profession: "Engineer"},
{Name: "Deepak", Country: "America", Profession: "Engineer"},
{Name: "Anjali", Country: "India", Profession: "Doctor"},
{Name: "Ayushman", Country: "America", Profession: "Lawyer"}
)
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-03.webp)
Step 4: Select the button while holding down the Alt key. We can see the collection variable created in power Apps.
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-04.webp)
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-05.webp)
We can also see the collection which is created by clicking on the MyCollection in the formula bar.
Step 5: Insert a Data table control, and set its Items property to this formula:
Power Apps Formula
We can view the result of this formula in the formula bar by selecting the entire formula:
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-06.webp)
Step 6: Select the Data table control and click on Edit fields link in the data table's properties pane to add the Value column.
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-07.webp)
Click on + Add field.
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-08.webp)
Click on Checkbox and select Add.
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-09.webp)
![Distinct function in Power Apps Distinct function in Power Apps](media/distinct-function-10.webp)