cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AmitSaraswat
Frequent Visitor

Weekend Calculation- Select startdate & enddate - weekend calculate (Saturday & sunday count 1(one))

I need weekend calculation based on selection of start date and enddate and saturday and sunday count one

 

ClearCollect(DateRange,AddColumns(FirstN([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],DateDiff(DataCardValue22.SelectedDate, DataCardValue21.SelectedDate, Days) + 1),"Day","Day" & (Value + 1),"Date",DateAdd(DataCardValue22.SelectedDate, Value, Days),"Weekend",If(Weekday(DateAdd(DataCardValue22.SelectedDate, Value, Days))=1 ||Weekday(DateAdd(DataCardValue22.SelectedDate, Value, Days))=7,1,0)));

UpdateContext({showWeekendCount:true})

 

 

currently i using above code but that is only calculated the till 9 weekend i want dynamic not fixed.

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @AmitSaraswat,

 

I have made a test on my side, if you want to calculate the weekend (Saturday&Sunday count 1 one) between the two different dates dynamically, I afraid that there is no way to achieve your needs in PowerApps currently.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

In addition, I don't think the formula that you provided could calculate weekend (Saturday&Sunday count once) between two different dates. If the dates between the startdate and the enddate contains Saturday and Sunday, the formula that you provided would count weekend twice (One for Saturday, one for Sunday).

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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