Did you know how to set dropdown values based on a variable? If No, No worries!
In this Power Apps tutorial, I will show you how to set Power Apps Dropdown values Based on variable.
How to Set Power Apps Dropdown Values Based on Variable
In this section, I will explain how to set a Power Apps dropdown value based on a variable
Example 1:
- In Power Apps, there is a Slider Control and a Dropdown control.
- When the user adjusts the slider, based on it, the dropdown items will be selected.

To achieve this, follow the below steps:
- On the Power Apps screen, insert a Slider Control -> Set its OnChange property to:
If(
Self.Value = 100,
UpdateContext({varSetDrp: {Value: "Completed"}});
Reset(drp_ProjectStatus),
Self.Value < 2,
UpdateContext({varSetDrp: {Value: "Not Started"}});
Reset(drp_ProjectStatus),
Self.Value < 100,
UpdateContext({varSetDrp: {Value: "In progress"}});
Reset(drp_ProjectStatus)
)
Where,
- varSetDrp = Variable name
- Completed = Dropdown value
- drp_ProjectStatus = Dropdown control name

- Insert a Dropdown control -> Set its Items property to:
varSetDrp.Value

- Save, Publish, and Preview the app. When the user moves the slider, based on it, the dropdown value will be selected automatically.

This is how we can set a Power Apps dropdown value based on a variable.
Example 2: [Using SharePoint List]
I have a SharePoint list [Employee Details], which has various columns like:
Column Name | Data Type |
---|---|
Employee ID | Title |
Employee Name | Lookup |
Employee Department | Lookup |
Gender | Choice [Male, Female] |
Joined Date | Date and time |

- In Power Apps, there is a Text input control, a Search icon, and a Dropdown control.
- The dropdown control has the values from a department column [IT, Marketing, Finance, HR].
- Whenever the user provides their Employee ID in the text input control and clicks on the search icon, by default, the dropdown item will be selected for their department.

Let’s see how to achieve this:
- On the Power Apps screen, insert a Text input control -> Set its Hint text property to:
"Provide Your Employee ID"

- Insert a Search icon -> Set its OnSelect property to:
Set(
varEmpDepartment,
LookUp(
'Employee Details',
Title = txt_EmployeeID.Text
).Department.Value
)
Where,
- varEmpDepartment = Variable Name
- Employee Details = SharePoint list name
- Title = SharePoint list column which has all the Employee ID
- txtEmployeeID = Text input control name
- Department = SharePoint list column name

- Insert a Dropdown control -> Set the below-mentioned dropdown properties to
Items = Distinct(
'Employee Details',
Department.Value
)
Default = varEmpDepartment

- Save, Publish, and Preview the app. When you provide the employee ID and click on a search icon, the dropdown value will be selected based on the provided employee ID.

This is how we can set a Power Apps dropdown value based on a variable using the SharePoint list as a data source.
Conclusion
I hope this Power Apps tutorial assisted you in knowing how to set a Power Apps dropdown value based on a variable.
Also, you may like some more Power Apps tutorials:
- Validate Power Apps Dropdown Control
- Bind Power Apps Dropdown Control From SharePoint Yes No Column
- Set Default Value in Power Apps Dropdown Control from SharePoint list
- Bind SharePoint Lookup Column in Power Apps Dropdown
- How to Filter Power Apps Gallery By Dropdown?
Bijay Kumar Sahoo is a highly accomplished professional with over 15 years of experience in the field of SharePoint and related technologies. He has been recognized as a Microsoft MVP (Most Valuable Professional) more than 9 times, starting from April 2014, for his exceptional contributions to the SharePoint community. Bijay is also a prolific author, having written two books on SharePoint – “Microsoft Power Platform – A Deep Dive” and “SharePoint Online Modern Experience Practical Guide“. His deep insights into SharePoint are also shared on his popular YouTube channel EnjoySharePoint where he teaches SharePoint to a global audience (From various countries like the United States of America, Canada, the United Kingdom, Australia, New Zealand, etc). Read more…