Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MissBI_21
Helper II
Helper II

Individual dates between a period with an 'exclude weekend' filter

Hi,

 

I was wondering if someone could help! 

 

Currently I have data in a table the gives me the start and end dates of people on training. I have the following DAX that gives me the dates in between the start and end dates: {Number.From([start_date])..Number.From([end_date])}

 

The reason I use the above DAX is because my stakeholders like to see how many training days were booked in a month, and if the training goes over two months, I am able to split the days for each month.


Before, people would not book over weekends unless training had happened over a weekend. Now, there's a column been added to the table, 'Exclude Weekends' which has one of two options, true or false. As this function is now available, people are now able to book training over a weekend regardless of whether or not training was completed over a weekend.

 

If 'Exclude Weekends' is true, that means there was no training over a weekend and if it is false, that means training did happen over a weekend. 

Do you know how I can exclude the weekends that are true from the total count for the month?

1 REPLY 1
amitchandak
Super User
Super User

@MissBI_21 , You can get like

List.Select( List.Dates([Start Date], Duration.Days([End Date] -[Start Date]) +1 ,#duration(1,0,0,0) ) , each Date.DayOfWeek(_,Day.Sunday) <5)

 

 

Refer for other steps

https://amitchandak.medium.com/power-query-get-all-dates-between-the-start-and-end-date-9ad6a84cf5f2

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.