In PowerApps, we have calendar control which works fine but I have seen a lot of requirements to have a dropdown with only Month Name and Year. You may know that we don’t have the option to display Calendar without the date. So if you are looking for similar requirements then you are in the right place to learn.
UI (Month and Year)
One option is to have a table but here we are looking without any table or data source.
Power Fx Code
- Set OnStart of the App to
So above code produces months and years from 2000 to 2041. WHY We defined until 2049 right. You are right but the dropdown maximum capability is 500 items.
- Insert a dropdown and Set the Items property to
- Select the dropdown and set the Value property to MonthYear
- Insert a label to show the selected value from the dropdown. Set the text property of the label to
- Insert another label and set the text property to
Month Number and Year will display for the dropdown selection. Noticed displaying the month name on the UI and using the month number for all our calculations like filter or Sum
Reference (Power Fx Code)
) As SourceYear,
Happy Development! Reach me if any questions.