- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DAX: Count the number of weekdays (not weekends) TM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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)
)
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview. ✨
️ November 12th-14th, 2024
Online Event
Register Here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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)
)
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview. ✨
️ November 12th-14th, 2024
Online Event
Register Here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You have the STARTOFMONTH() function that should do the trick.
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
06-29-2024 04:35 AM | |||
06-07-2024 03:58 PM | |||
10-22-2023 10:00 PM | |||
02-22-2024 03:03 AM | |||
07-10-2024 12:43 PM |
User | Count |
---|---|
118 | |
79 | |
47 | |
45 | |
32 |
User | Count |
---|---|
172 | |
90 | |
66 | |
46 | |
45 |