Hi @venky232 ,
Create a button control named "btnCountWorkingDates" with the Text property set to "Count Working Dates."
Add the following code to the OnSelect property of the "btnCountWorkingDates" button:
// Define the selected month and year
Set(
selectedMonth,
Value(ddMonth.Selected.Value)
);
Set(
selectedYear,
Value(ddYear.Selected.Value)
);
// Calculate the number of working days
Set(
startDate,
Date(selectedYear, selectedMonth, 1)
);
Set(
endDate,
Date(selectedYear, selectedMonth + 1, 0)
);
Set(
workingDaysCount,
0
);
ForAll(
Filter(
AddColumns(
Sequence(endDate - startDate + 1, startDate),
"DayOfWeek",
Weekday(Date)
),
DayOfWeek <> 1 && DayOfWeek <> 7 // Exclude Sunday (1) and Saturday (7)
),
Set(
workingDaysCount,
workingDaysCount + 1
)
);
// Show the result
Notify("Number of working days: " & workingDaysCount, NotificationType.Success);