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 / Excluding bank holiday...
Power Apps
Unanswered

Excluding bank holidays and weekends

(0) ShareShare
ReportReport
Posted on by 199

I’m working on a holiday booking app. I need to calculate the number of days selected, excluding bank hols and weekend. I watched a video which showed how to do this using two date pickers and connecting to my BankHolidays list.

1.png

I’m using CountRows(glbFilteredDates) in a text label to display – which is working nicely.

But this is a side list which just holds the bank holidays. My users are creating the booking on another SharePoint list, called  TimeOffTracker. Is it possible to:
1. Have users create the booking in the TimeOffTracker list
2. Then as the user selects an end date, the app references the BankHoliday list and calculates the number of working days
3. User then submits the request which creates the booking and adds the number of working days to the number of days column in the TimeOffTracker list.

 

I tried the formula with a form and the two date datacards connected to TimeOffTracker but it doesn’t quite work.
I would like the number of days to be calculated when user selects an end date, so I put the formula in the end date’s OnSelect property. Then I was hoping to can use the form’s submit button to write the information back to the TimeOffTracker list.  

2.png

This time Count rows is showing an error.  

3.png


Hope that makes sense! Any help would be gratefully received. Thank you. 

 

Categories:
  • CU18061035-1 Profile Picture
    Microsoft Employee on at

    hey @Victoria 

     

    can you please copy paste your codes here so we do not have to retype? Thanks in advance.

     

    If possible please use the <> icon on the top of the reply, there you can insert code samples, would make it easier too.

     

    thanks

  • Victoria Profile Picture
    199 on at

    DataCardValue  - On Select property

    ClearCollect(colPublicHolidays,BankHolidays.Date);
    Set(glbNoOfDays1, DataCardValue5.SelectedDate-DataCardValue6.SelectedDate+1);
    Set(glbDates1,
    ForAll(
     Sequence(glbNoOfDays1,0) As DV,
     {
    Date:DataCardValue5.SelectedDate+DV.Value,
    Day:Text(DataCardValue5.SelectedDate+DV.Value, "dddd"),
    PublicHol:DataCardValue5.SelectedDate+DV.Value in colPublicHolidays
     }
    ));
    Set(glbFilteredDates1,
    Filter(glbDates1,
    Not(Day in ["Saturday","Sunday"]) And Not (PublicHol)));

    Number of days card - default property

    CountRows(glbFilteredDates1)
  • Victoria Profile Picture
    199 on at

    Have done, thank you

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard