web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dropdown list of Sunda...
Power Apps
Answered

Dropdown list of Sundays is broken .... please help (suddenly showing Thurs)

(0) ShareShare
ReportReport
Posted on by 24

Hi,

 

I have been using this code since 1st July 2022 to create a dropdown with a sequence of Sundays ... 4 weeks back and 16 weeks forward.

 

On App Startup:  (spaces added to make it more readable)

 

Set(
    weeksList ,
        ForAll ( Sequence ( 20, Day ( DateAdd ( Today(), -1 * ( Weekday ( Today(), Monday ) - 1), Days ) - 28, 7 ) ,
        Date ( Year ( Today() ), Month ( Today() ), Value )
    )

 

Then on the dropdown in question:-

 

AddColumns ( weeksList, "WeekEnd", Text( DateAdd (Value,6,Days), "ddd, dd-mmm-yyyy")

 

Yesterday, its started to fail and now gives me Thur in the dropdown instead of Sunday ... 1st Sep, 8th Sept etc... bizarre.

Am I missing something obvious here??   If there is a cleaner better way to just produce a list of Sundays, I'm happy to hear it ... I hate all the +6d stuff going on that I have to use.

 

Cheers community for your help

Andre

Categories:
I have the same question (0)
  • aedmunds Profile Picture
    24 on at

    Looking at it again ... it seems the "day" component is correct, but its slipped a month ... i.e. if I set the offset starting point to 0 ... it does the right day for the start of the week ... 29th ... as in August, but it adds it to current month sept ... hmmm ... 

     

    So this part seems to be breaking it for a long 5 week month ... 

     

    Date(
         Year(Today()),
         Month(Today()),
         Value
    )

     

    Appending the correct day to the wrong month

  • Verified answer
    timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    @aedmunds 

    This is how I would do it:

    Set(
     weeksList,
     With(
     {
     thisSunday: DateAdd(
     Now(),
     -(Weekday(
     Now(),
     StartOfWeek.Monday
     )),
     Days
     )
     },
     AddColumns(
     ForAll(
     Sequence(
     20,
     -4
     ),
     {
     sundayDate: DateAdd(
     thisSunday,
     7 * Value
     )
     }
     ),
     "sundayDateFormatted",
     Text(
     sundayDate,
     "ddd, dd-mmm-yyyy"
     )
     )
     )
    )

    This would then produce a "sundayDateFormatted" column in your variable, and you can avoid calling AddColumns in the Items property of your dropdown.

     

     

    timl_0-1662036600128.png

     

  • aedmunds Profile Picture
    24 on at

    That's cool and works for that Sequence, thanks mate.

     

    I've since found an even cleaner way to achieve a similar thing in another thread which works even better ... like this within the Set(weeksList, ...

     

    ForAll(
     Sequence(13, -4),
     {
     myDate: DateAdd(Today(),-(Weekday(Today()) - 2) + 7 * - Value)
     }
    )

     

    Cheers for that time and effort working through that,  much appreciated.

  • aedmunds Profile Picture
    24 on at

    Thanks for working through that and I can see that would solve it.

     

    On another thread, I got this answer which is an even cleaner way to do it and I have implemented this one now...

     

    ForAll(
     Sequence(13, -4),
     {
     myDate: DateAdd(Today(),-(Weekday(Today()) - 2) + 7 * - Value)
     }
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard