Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I want to have something similar to "countifs" - I want to count the days in the current month which aren't Saturdays or Sundays.
I work with an online DB and can't create additional columns.
My column 'Date'[Date] lists all dates continously, day by day, including weekends.
I have this, which doesn't work:
JustWorkdaysThisMonth = CALCULATE(
COUNTROWS(DATESMTD('Date'[Date])),
FILTER('Date', WEEKDAY('Date'[Date]="Saturday") || WEEKDAY('Date'[Date]="Sunday"))
)
Do you have any advice?
Solved! Go to Solution.
@BerlinAlexander , Try like
JustWorkdaysThisMonth = CALCULATE(
COUNTROWS(FILTER('Date', WEEKDAY('Date'[Date],2) <6)),DATESMTD('Date'[Date])
)
or
JustWorkdaysThisMonth = CALCULATE(
COUNTROWS('Date'),DATESMTD('Date'[Date])
FILTER('Date', WEEKDAY('Date'[Date],2) <6)
)
Hi,
Could you try something like this :
IsWeekDay= SWITCH (MyCalendar[WeekDayName]; "sunday" ; 0; "saturday";0;1)
Then you can do a sum on this column IsWeekDay.
Hope this helps
@BerlinAlexander , Try like
JustWorkdaysThisMonth = CALCULATE(
COUNTROWS(FILTER('Date', WEEKDAY('Date'[Date],2) <6)),DATESMTD('Date'[Date])
)
or
JustWorkdaysThisMonth = CALCULATE(
COUNTROWS('Date'),DATESMTD('Date'[Date])
FILTER('Date', WEEKDAY('Date'[Date],2) <6)
)
Thanks a lot. I have one additional question.
It seems that this is considering the whole month.
If I wanted to have MTD instead (i.e. today is July 15th, so I would like to consider just the time since the month beginning till July 15th), how should I change the code?
Hi,
You have the STARTOFMONTH() function that should do the trick.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
81 | |
64 | |
49 |
User | Count |
---|---|
123 | |
109 | |
88 | |
68 | |
67 |