How to Set Dropdown Default Value To Variable in Power Apps?

Did you know how to set a dropdown default value to a variable in Power Apps? In this Power Apps tutorial, I will show you how to set dropdown default value to variable in Power Apps.

Set Dropdown Default Value To Variable in Power Apps

In this section, I will explain Power Apps assign a dropdown default value to a variable.

Example,

I have a SharePoint list [User Subscription Details] that has various columns like:

Column NameData Type
User IDTitle
Country Single line of text
Subscription TypeChoice [Premium, Standard, Basic]
How to set Power Apps dropdown default value to variable

I created a Power Apps Canvas app and then added a Dropdown control connected to the above SharePoint list country column.

When the user opens the app, the dropdown item will be selected by default as “United States.” Then, the label [variable] will update automatically based on the dropdown selected value.

Set Power Apps dropdown default value to variable

Follow the below steps to achieve this:

  • On the Power Apps screen, insert a Dropdown control -> Set its Items property to:
Distinct('User Subscription Details',Country)

Where,

  1. User Subscription Details = SharePoint list name
  2. Country = SharePoint list column name
How to set dropdown default value to variable in Power Apps
  • Now, to set a variable based on the default value, select the Dropdown control -> Set its OnChange property to:
Default = "United States"


OnChange = Set(
    varCountry,
    drp_Country.Selected.Value
)

Where,

  1. United Stated = Dropdown value
  2. varCountry = Provide the variable name
  3. drp_Country = Dropdown control name
Set dropdown default value to variable in Power Apps
  • Insert the Text label control -> Set its Text property to:
varCountry

Where,

  • varCountry = Variable name
Power Apps dropdown set default value to variable
  • Save, Publish, and Preview the app. By default, the dropdown value will be selected as “United States.” Then, the text label [variable] will update automatically based on the dropdown selected value.
Power Apps set dropdown default value to a variable

This is how we can set a dropdown default value to a variable in Power Apps.

Conclusion

I trust that this tutorial has helped provide knowledge on how to set the dropdown default value to a variable in Power Apps.

You may also like: