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 / Weekly Date Ranges and...
Power Apps
Unanswered

Weekly Date Ranges and Default Selected

(0) ShareShare
ReportReport
Posted on by 16

Building a quick app here to update weekly progress.  The date ranges are every Monday - Friday.  I use this to determine the dates:

 

SortByColumns(

With({ withList:
ForAll(Sequence(21,-20,1) As DD,
DateAdd( DateAdd(Today(), -Weekday(Today(), StartOfWeek.Monday) +1), 4 * DD.Value , TimeUnit.Days)
)},

AddColumns(withList, "WeekEnd", DateAdd(Value, 5, TimeUnit.Days), "Week Display", Value & " to " & DateAdd(Value, 4, TimeUnit.Days))
),"Value",SortOrder.Descending)

 

Seems to work well to display them as it looks here:

gmshelley_1-1700257615756.png

 

 

Two issues:

When I update to the Sharepoint list, the first date (Monday) is the date that sends.  Not a huge deal, but somehow struggling to send it even as just a text to display, but then that won't sort properly, so I think I am ok with this being the case with one date.

 

The second issue is my larger question.  How do I get this to pull the date when I am in edit mode.  When I am in read mode, it looks like this below and includes the first date which matches SharePoint:

gmshelley_2-1700257783304.png

In edit, it is defaulting to nothing and I cannot figure out what to put in defaultselecteditems to get this to populate corectly. 

 

gmshelley_3-1700257844528.png

Any help would be greatly appreciated!

 

 

 

 

Categories:
  • Power5 Profile Picture
    on at

    What gave you tried in default selected items?

  • gmshelley Profile Picture
    16 on at

    I actually ended up figuring it out and added this: If(SharePointForm1.Mode=FormMode.New,First(varWeeklyDates)) The issue is that my variable below shows 5 days which is great, but I can't now figure out how to make it only show Monday -Friday for all the dates. Case in point, this week it properly shows 11/20-11/24, but now the second dropdown shows 11/16-11/20.  I would like it to show 11/20-11/4, then 11/13-11/17, then 11/6-11/10 and so on.  Any idea how I can edit this to make it work?!

     

     

    Set(varWeeklyDates, (SortByColumns( With({ withList: ForAll(Sequence(21,-20,1) As DD, DateAdd( DateAdd(Today(), -Weekday(Today(), StartOfWeek.Monday) +1), 4 * DD.Value , TimeUnit.Days) )}, AddColumns(withList, "WeekEnd", DateAdd(Value, 5, TimeUnit.Days), "Week Display", Value & " to " & DateAdd(Value, 4, TimeUnit.Days)) ),"Value",SortOrder.Descending)))

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard