cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LiamR89
Helper I
Helper I

Getting dates between datepickers.

Hi all after some help please,

Built the beginnings of a Holiday booking app (copied from a very good guide here)

I'd like to add in a gallery showing all dates between the start and end dates booked, to allow users to select if this day is a half day.

I imagine it is some combination of sequence and for all but I can't get it , also i'd only like to show the days we're actually booking - so exclude any weekend days and non working days ( I have this working in a label)

So for the below dates picked there are only actually 2 working days so I'd like my horizontal gallery just to have those days.

Any help will be much appreciated.

Thanks

 

2021-03-11 13_52_51-Graphs - Power Apps.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@LiamR89 

Please consider changing your Formula to the following:

 

Filter(         
    ForAll(Sequence(DateDiff(dte_Event_StartDate.SelectedDate, dte_Event_EndDate.SelectedDate, Days) + 1),
        With({_cDate: DateAdd(dte_Event_StartDate.SelectedDate, Value, Days)},
            {
                AddedDate: If(WeekDay(_cDate) = 7 || WeekDay(_cDate) = 1 || !(_cDate in NonWorkingDays.Date), Blank(), _cDate)
            }
        )
    ),
    !IsBlank(AddedDate)
)    

 

 

That should give you what you are looking for and perhaps a little easier to maintain and change.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
LiamR89
Helper I
Helper I

I have this working, could have combined the filters but it works regardless.

Filter(
Filter(
Filter(
AddColumns(
Sequence(
Sum(
DateDiff(
dte_Event_StartDate.SelectedDate,
dte_Event_EndDate.SelectedDate,
Days
) + 1
)
),
"AddedDate",
DateAdd(
dte_Event_StartDate.SelectedDate,
Value
) - 1
),
Text(
AddedDate,
"[$-en-US]ddd"
) <> "Sat"
),
Text(
AddedDate,
"[$-en-US]ddd"
) <> "Sun"
),
Not(AddedDate in NonWorkingDays.Date)
)

LiamR89_0-1615473103950.png

 



RandyHayes
Super User III
Super User III

@LiamR89 

Please consider changing your Formula to the following:

 

Filter(         
    ForAll(Sequence(DateDiff(dte_Event_StartDate.SelectedDate, dte_Event_EndDate.SelectedDate, Days) + 1),
        With({_cDate: DateAdd(dte_Event_StartDate.SelectedDate, Value, Days)},
            {
                AddedDate: If(WeekDay(_cDate) = 7 || WeekDay(_cDate) = 1 || !(_cDate in NonWorkingDays.Date), Blank(), _cDate)
            }
        )
    ),
    !IsBlank(AddedDate)
)    

 

 

That should give you what you are looking for and perhaps a little easier to maintain and change.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,395)