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 / Dynamic Calendar of 5 ...
Power Apps
Unanswered

Dynamic Calendar of 5 Days From the Week

(0) ShareShare
ReportReport
Posted on by 75

Hi Gurus,

 

Can someone give some ideas about how to dynamically make the data selector (based on a certain date) get the next 5 working days?

 

The scenario that I have is as follows:

1- I have a screen where the user can see a date selector (I copied it from the screen type 'Calendar'), and in the Gallery instead of providing a string of 1 up to 41 as defaulted, I want to show 5 days from a certain day that I can fetch from field in a sharepoint list.

Muhja_0-1646312925471.png

 

the sharepoint list has the field called 'Calculated Date' which is going to have a specific date e.g. 31/3/2022 and if I pass it to the gallery, then  it should show the next five working days from that day only which means the dates from  3rd to 7th of April only to pick from.

Note: that working days in my region is Sunday till Thursday so Friday and Saturday is the weekend, where user cannot pick from.

 

What can be the condition or formula here?

 

Thanks, looking forward to your support.

Categories:
  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    I can get you started down the road, sorry I don't have the time right now to completely answer.

    You can get the next 5 days with this formula:

    Clear(col_Dates);
    ForAll(Sequence(5),

           Collect(col_Dates,{Day:ThisRecord.Value, DatePick: DateAdd(DatePicker1.SelectedDate,ThisRecord.Value)}))

     

    This creates a collection with a number and the date.

    You will need to check those with the Weekday function - the link is here

    That will return the days of the week as numbers. You can use an If statement to drop out the days between Friday and Sunday. You can use that collection to feed a drop-down or gallery for people to pick from.

     

    Hope that helps get you started. Sorry I don't have time to be more specific

  • Muhja Profile Picture
    75 on at

    Hello BrianS,

     

    I tried applying the same, still need you to clarify it further. Currently it is showing the following in the collection and the gallery:

     

    Muhja_1-1646572044991.png

     

    Muhja_2-1646572073931.png

    I'm new to collections, so this partially clear to me, however the part of the weekday also how to reflect numbers in the gallery. Thanks.

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    The icon in the date column indicated there is an entire record in that field. You need to double check the code creating that field. In the formula I gave you you could substitute your calculated field for the date picker if you want that to determine the dates offered. 

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    To limit the days of the week to the days you want it may be easier to set the collection at 7 days and then remove the Friday and Saturday with the weekday function. This should work - again you can replace the date picker with your SP calculated column:

    Clear(col_Dates);
    ForAll(Sequence(7),
    Collect(col_Dates,{Day:ThisRecord.Value,
    DatePick: DateAdd(DatePicker1.SelectedDate,ThisRecord.Value),
    DayWeek:Weekday(DateAdd(DatePicker1.SelectedDate,ThisRecord.Value))}))

     

    You can then use the DatePick and DayWeek field to populate the list of available dates and days of the week

  • Muhja Profile Picture
    75 on at

    thanks that worked fine. Appreciate it BrianS.

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard