cancel
Showing results for
Search instead for
Did you mean:

## Weekend Calculation- Select startdate & enddate - weekend calculate (Saturday & sunday)

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.

Status: New
Comments
Power Apps

This is an interesting calculation. My suggestion is that rather than hardcoding your series of numbers from 0-59, I would create a table of whole numbers up to the highest number you would expect. For instance, if I only expect fewer than 1000 days in a range, I would make a table with one column of numbers 0-1000.

Here's an example of an app with this table of whole numbers added as static data:

https://powerblob.blob.core.windows.net/powerapps/144282.msapp

Completed Ideas