cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
indhaa
Impactful Individual
Impactful Individual

Count no of days between a date range

Hi

 

I want to count how many Fridays and Saturdays are between a date range.

 

So if I have a Start Date and a End Date, I would like to know how many Fridays and Saturdays are in this range. What is the best way to do this

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

There may be a better way to do this but you could achieve same with this approach:

1. Insert 2 DatePickers (DatePicker3 and DatePicker4)

2. Insert a Button with OnSelect:

   

UpdateContext({varDateRangeDays: DatePicker4.SelectedDate - DatePicker3.SelectedDate});
ClearCollect(
    DateRange,
    ForAll(
        Sequence(
            varDateRangeDays,
            1
        ),
        Weekday(
            DateAdd(
                DatePicker3.SelectedDate,
                Value
            )
        )
    )
)

  

3. Finally, to Count the number of days for example in a Label:

  CountRows(Filter(DateRange,Value< 6))

 

Depending on the Start of the week for you, Foe instance if the Start day of the week is Sunday, then Friday is 6, Saturday is 7. So change the to suit your situation

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

 

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

There may be a better way to do this but you could achieve same with this approach:

1. Insert 2 DatePickers (DatePicker3 and DatePicker4)

2. Insert a Button with OnSelect:

   

UpdateContext({varDateRangeDays: DatePicker4.SelectedDate - DatePicker3.SelectedDate});
ClearCollect(
    DateRange,
    ForAll(
        Sequence(
            varDateRangeDays,
            1
        ),
        Weekday(
            DateAdd(
                DatePicker3.SelectedDate,
                Value
            )
        )
    )
)

  

3. Finally, to Count the number of days for example in a Label:

  CountRows(Filter(DateRange,Value< 6))

 

Depending on the Start of the week for you, Foe instance if the Start day of the week is Sunday, then Friday is 6, Saturday is 7. So change the to suit your situation

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

 

View solution in original post

indhaa
Impactful Individual
Impactful Individual

Thanks

 

Able to use this with some customization 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,492)