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 / Power Apps Sequence Fu...
Power Apps
Unanswered

Power Apps Sequence Function

(0) ShareShare
ReportReport
Posted on by 2

I have created a sequence function on the app start up to enable me to load a date range This works fine and the date range loads with the correct format in a drop down field, however I need it to default to the current week and not the past week or in my case the week 2 weeks prior based on the selection in the sequence.

 

Is there a way I can add to the sequence that will ensure on load it defaults to the current week and then allows the user to select a previous week from the drop down if required. 

 

I should add this is part of a timesheet app.  Sequence code is

 

Concurrent(
Set(
CurrentUser,
User()
),
Set(
ConcurrentMonday,
DateAdd(
Today(),
-1 * (Weekday(
Today(),
Monday
) -1),
Days
)
),
Set(
weekList,
ForAll(
Sequence(
10,
Day(
DateAdd(
Today(),
-1 * (Weekday(
Today(),
Monday
) - 1),
Days
)
) - 14,
7
),
Date(
Year(Today()),
Month(Today()),
Value
)
)
)
);

 

Ignore the current user section at the very top of the info above. its the section from the Set highlighted in red that set's my date range,

 

In addition I also have the following set on the drop down field on the screen that populates this data, in the 'Items' section of the field setting.

 

AddColumns(
weekList,
"WeekEnd",
DateAdd(
Value,
6,
Days
),
"Week Display",
Value & " to " & DateAdd(
Value,
6,
Days
)
)

 

You can see from the screenshot the date range defaults to 2 weeks prior not this week, e.g. 03.01.2022 - 09.01.2022 etc.

Stuartnt_0-1641470010613.png

 

Thanks in advance

Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I think I figured it out for you.   I wasn't able to do it at all originally due to the way Add columns transforms the data source.  

     

    In the initial sequence change the name of the variable you are using for your sequence to something like tempWeekList.

     

    Then add this:

     

     

    ClearCollect(weekList,
    AddColumns(
     tempWeekList,
     "Week Display", Value & " to " & DateAdd(Value,6,Days)
    ))

     

     

    Set your ComboBox Items property to 'weekList' and select the Week Display field.

     

    Set your DefaultSelectedItems to:  (This finds the Monday of the current week and uses it for comparison)

     

     

    [LookUp(weekList, Value = DateAdd(Today(),1-Weekday(Today(),StartOfWeek.Monday),Days)).'Week Display']

     

      

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 413

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
timl Profile Picture

timl 315 Super User 2026 Season 1

Last 30 days Overall leaderboard