Forum Discussion
Working days in current month
- 1 year ago
Since you cannot use CALENDAR or GENERATESERIES, you can take a different approach by iterating over a range of days using a loop-like function. Try below solution
WorkingDays_CurrentMonth =
VAR StartDate = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
VAR EndDate = EOMONTH(StartDate, 0)
VAR DaysCount =
SUMX(
ADDCOLUMNS(
SELECTCOLUMNS(UNION(SELECTCOLUMNS({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},
"Offset", [Value])
),
"Date", StartDate + [Offset] - 1,
"Weekday", WEEKDAY(StartDate + [Offset] - 1, 2)
),
IF([Date] <= EndDate && [Weekday] < 6, 1, 0)
)
RETURN DaysCount๐ I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
๐ก Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
๐ As a proud SuperUser and Microsoft Partner, weโre here to empower your data journey and the Power BI Community at large.
๐ Curious to explore more? [Discover here].
Letโs keep building smarter solutions together!
Thank you for trying to help. Unfortunately CALENDAR is not a function for me, so this formula only errors.
Is there another way?