I need a Dropdown that allows the user to choose a date range that includes two weeks at a time.
When the user opens the Dropdown they should be able to choose from a list of date (in two week blocks), with the defaul date being including current date, however that range shoud start at the Sunday before.
The should be able to go as far back a one month and as far into the feature as the system allows.
Hey @Phineas,
If you are generating this dynamically in PowerApps, it will be different every time you load it - is that OK?
Here is an example of how I implemented with a combo box (so I could show the period number and the date range at the same time):
With(
//Get Sunday before-last as Seed Day
{SeedDate: DateAdd(Today(), -Weekday(Today(), Monday) - 7, Days)},
ForAll(
//Generate a list of 2-week period starting from 2 periods before Seed Date
Sequence(10, -2, 1) As Offset,
{
Number: Text(Offset.Value + 3),
Dates: Text(DateAdd(SeedDate, Offset.Value * 14, Days), "dd/mm/yyyy") & " - " & Text(DateAdd(SeedDate, (Offset.Value + 1) * 14 - 1, Days), "dd/mm/yyyy")
}
)
)
The first argument of Sequence(), which is 10 in my example, can be adjusted to determine the number of periods generated.
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional