'PowerApp Distinct function with DropDown variable
I am trying to create dependent (linked) dropdowns in my PowerApps. Specifically, I want to select the distinct values of a column selected from a drop-down (see below, where the first dropdown contains the column, and the second should contain the distinct values of that column:
I want to have the distinct values of the column selected in the first dropdown.
I tried to use this function for the second dropdown:
Distinct('SQLTableName', dropdown_1.SelectedText.Value)
But it does only generate the selected value itself, instead of a list of distincts, as seen below:
Solution 1:[1]
The second argument to the Distinct function is an expression that will be used on each record of the table. In your example above the expression will be the same (the text shown in the first dropdown). At this point Power Apps does not allow retrieving the value of a column given its name directly, so you will need to use something along the lines of the expression below:
Distinct(
'SqlTableName',
Switch(
dropdown_1.SelectedText.Value,
"CustomerId", CustomerId,
"CustomerName", CustomerName,
"OtherTableColumn", OtherTableColumn,
...))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | carlosfigueira |


