Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi - New PBI user here.....
Struggling with DAX code for a simple calculation to Count total days of the week (ignore Sat / Sun)
Column for 'Days difference' between 2 dates, and for the days difference total to ignore saturday / sunday, returning values of 1 for days of the week and returning 0 for sat/sun entries?
Any assistance appreciated....
Hiya @Smithy33 ,
First welcome to the community!
Are you using a Date Table by any chance? If so in Power Query you could add a column to it by clicking on your data range field, going to Add Column at the top, click the Date section, hover your mouse over Day then select day of week. That will give you the numerical version of the weekday. If you are not using a Date Table then how are you determining the day of the week?
I wasn't sure where you were pulling your date range from so for this example I used my date calendar and did the difference between the min and max of my calendar (9/21/2020 to 9/21/2021). Here's the formula I used:
Total Working Days =
VAR MaxDate =
MAX ( Calendar[Date Range] )
RETURN
CALCULATE (
COUNT ( Calendar[Date Range] ),
DATEDIFF ( MaxDate, Calendar[Date Range], DAY ),
AND ( Calendar[Day of Week] <> 0, Calendar[Day of Week] <> 6 )
)
This resulted in a total of 261 working days.
Proud to be a Super User!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |