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

Notifications

Announcements

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard