Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to count no of working days

(0) ShareShare
ReportReport
Posted on by

i have 1 date picker, when user select date - it should show count of working days excluding weekends & holidays in that selected month.
holidays stored in Collection as 

ClearCollect(Holidays,

{Date1:7/24/2023,Type:Pioneer Day},

etc......

Categories:
  • venky232 Profile Picture
    on at
    Re: How to count no of working days

    but it is not excluding holidays list from collection

    ClearCollect(
    Col_Holidaylist,
    Table(
    {Date1: Text(DateValue("16-Jan-2023"), "d-mmm-yyyy"), Type: "Optional Holiday"},
    {Date1: Text(DateValue("26-Jan-2023"), "d-mmm-yyyy"), Type: "Company Holiday"},
    {Date1: Text(DateValue("8-Mar-2023"), "d-mmm-yyyy"), Type: "Optional Holiday"},
    {Date1: Text(DateValue("22-Mar-2023"), "d-mmm-yyyy"), Type: "Optional Holiday"},
    {Date1: Text(DateValue("4-Apr-2023"), "d-mmm-yyyy"), Type: "Optional Holiday"}
    {
    )
    );

  • Verified answer
    v-hanytian-msft Profile Picture
    Microsoft Employee on at
    Re: How to count no of working days

    Hi @venky232 ,

     

    The Collection you offered.

    vhanytianmsft_0-1690186167314.png

    Text of TextLabel:

    With(
    {
    varDateRange: ForAll(
    Sequence(31,1),
    Text(Month(DatePicker1.SelectedDate) & "/" & Value & "/" & Year(DatePicker1.SelectedDate),"DD/MM/YYYY")
    )
    },
    // show only dates Monday to Friday and exclude holidays
    CountIf(
    varDateRange,
    And(
    Weekday(Value,StartOfWeek.Sunday) in [2, 3, 4, 5, 6],
    Not(Value in Holidays.Date1)
    )
    )
    )

    vhanytianmsft_1-1690186224181.png

     

    Hope this will help you,

    Best Regards,
    Tina

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard