cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Phineas
Post Prodigy
Post Prodigy

Dropdown Contains Dates in Two Week Groups

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.

Phineas_1-1659585358625.png

 

 

1 REPLY 1
metsshan
Solution Sage
Solution Sage

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):

metsshan_0-1659589525986.png

 

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.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,293)