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 / Star date to end date ...
Power Apps
Answered

Star date to end date Excluding weekend calculation

(0) ShareShare
ReportReport
Posted on by 59

when select start date and end date calculate date excluding weekend,

demo099_0-1650973073465.png

but when select last Saturday of month then add to the calculation excluding Sunday ,and when select start and end date as Saturday and Sunday then value show as 0.

 

Thanks & regards,

Riya

Categories:
I have the same question (0)
  • AsanKani Profile Picture
    710 on at

    Hi, @demo099 

    put below coding in your Days default value

    1 + ((DateDiff(DatePicker_Start.SelectedDate,DatePicker_End.SelectedDate,Days)) 
    * 5 - ((Weekday(DatePicker_Start.SelectedDate) - Weekday(DatePicker_End.SelectedDate))*2)) / 7 - Switch(Weekday(DatePicker_End.SelectedDate),7,1,0) - Switch(Weekday(DatePicker_Start.SelectedDate),1,1,0)

    and set your date picker StartOfWeek property StartOfWeek.Sunday

    I hope now your problem resolved.

    Give thumbs up to approach my reply and make me smile 

    Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

  • Dynatech123 Profile Picture
    59 on at

    Yes it works thanks @AsanKani,

    but when select last Saturday of month then add to the calculation excluding Sunday 

  • AsanKani Profile Picture
    710 on at

    You can try above coding working for your all testing. Saturday and Sunday exclude in count of week days.

    Kindly make above post if your issue is resolved make a solution. 

  • Dynatech123 Profile Picture
    59 on at

    Yes I tried and its work fine but I want that when select last Saturday of month then add to the calculation excluding Sunday for that I try to fetch date of last Saturday of current month using below formula :

    demo099_0-1651056225724.png

    now how I apply this date to the your suggested code for count last Saturday of current month.

    can you please help me with that .

  • Verified answer
    AsanKani Profile Picture
    710 on at

    Hoo, Now I am understand, 

     

    You need to add last Saturday of Current month date fall in your Start date to end date exclude last Sunday and  also other weekends.

    If my understand is right means use below coding to resolve your issue and make sure this post as your solutions. 

    1+((DateDiff(DatePicker_Start.SelectedDate,DatePicker_End.SelectedDate,Days))*5-((Weekday(DatePicker_Start.SelectedDate)-Weekday(DatePicker_End.SelectedDate))*2))/7-Switch(Weekday(DatePicker_End.SelectedDate),7,1,0)-Switch(Weekday(DatePicker_Start.SelectedDate),1,1,0)
    
    +
    
    If((With({NextMonth:DateAdd(Date(Year(Now()),Month(Now()),1),1,Months)},DateAdd(NextMonth,-1*Weekday(DateAdd(NextMonth,-7))))>DatePicker_Start.SelectedDate-1)&&(With({NextMonth:DateAdd(Date(Year(Now()),Month(Now()),1),1,Months)},DateAdd(NextMonth,-1*Weekday(DateAdd(NextMonth,-7))))<DatePicker_End.SelectedDate+1),1,0)

    before + Previous reply coding after + additional coding for your current needs. Above coding my side test and confirmed. Place above coding in your count text box

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways or you liked the post and want to show some appreciation, please give it a Thumbs Up.

  • Dynatech123 Profile Picture
    59 on at

    Hi @AsanKani , Yes it's work perfectly thank you for your suggestion.  

  • AsanKani Profile Picture
    710 on at

    Hi @demo099  You are welcome. 🤗

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard