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.
Step 2: Set the Text property of button to the Create Collection.
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"}
)
Step 4: Select the button while holding down the Alt key. We can see the collection variable created 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
We can view the result of this formula in the formula bar by selecting the entire formula:
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.
Click on + Add field.
Click on Checkbox and select Add.