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

Step 2: Set the Text property of button to the Create Collection.

Distinct function in Power Apps

Step 3: Set button control's OnSelect property to the below formula:

Power Apps Formula

ClearCollect(MyCollection,
{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

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

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

Distinct(MyCollection, Profession)

We can view the result of this formula in the formula bar by selecting the entire formula:

Distinct function in Power Apps

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

Click on + Add field.

Distinct function in Power Apps

Click on Checkbox and select Add.

Distinct function in Power Apps
Distinct function in Power Apps