It's possible to have a dropdown with year and month and force the datepicker range?
example:
ex: If i select Month January and year 2021 the filter datepicker range its 1/1/2021 to 31/01/2021
it's possible to force ?
Solved! Go to Solution.
Yes, you just need to have the DefaultDate property of the date picker be the value you want.
Ex. DatePicker1 DefaultDate property formula:
Date(yourYearDropDown.Selected.Value, yourMonthDropDown.Selected.Value, 1)
Your DatePicker2 DefaultDate property formula:
DateAdd(DateAdd(Date(yourYearDropDown.Selected.Value, yourMonthDropDown.Selected.Value, 1), 1, Months), -1, Days)
I hope this is helpful for you.
Yes, you just need to have the DefaultDate property of the date picker be the value you want.
Ex. DatePicker1 DefaultDate property formula:
Date(yourYearDropDown.Selected.Value, yourMonthDropDown.Selected.Value, 1)
Your DatePicker2 DefaultDate property formula:
DateAdd(DateAdd(Date(yourYearDropDown.Selected.Value, yourMonthDropDown.Selected.Value, 1), 1, Months), -1, Days)
I hope this is helpful for you.
What means the function for i understand the syntax?
yourMonthDropDown.Selected.Value, 1) why 1?
yourMonthDropDown.Selected.Value, 1), 1, Months), -1, Days) and why 1 Months and -1 days?
thanks
The Date function expects three parameters, the year, the month and the day. So, the formula:
Date(yourYearDropDown.Selected.Value, yourMonthDropDown.Selected.Value, 1)
will produce a date that is the first day of the selected year and month.
For the second datepicker, you wanted the last day of the month. So, the trick is to add 1 month to the first day of the month and then subtract 1 day. That will be the last day of that month.
DateAdd(DateAdd(Date(yourYearDropDown.Selected.Value, yourMonthDropDown.Selected.Value, 1), 1, Months), -1, Days)
So in the above formula, we again get the Year, Month and Day 1 date, and then add 1 month to it and subtract 1 day from it. That's the last day.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
184 | |
53 | |
50 | |
36 | |
35 |
User | Count |
---|---|
271 | |
91 | |
82 | |
76 | |
75 |