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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
sannadisarath
New Member

difference between two days excluding weekends

Hi All,

 

I want to get difference between two dates excluding weekends, please let me know what could be the formula.

i am pulling data from sharepoint online.

 

Thanks,
Sarath.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi sannadisarath,

 

According to your description, you want to get a date list between two dates except weekends, right?

 

If as I said, you can follow below steps:

1. Use CALENDAR function to create a datetable with two dates.

 

Dax: DateTable = CALENDAR(DATE(2010,1,1),TODAY())

Capture.PNG

 

2. Write dax formula to get the specify dates without weekends.

 

Dax: Date Except Weekends = CALCULATETABLE(DateTable,FILTER(ALL(DateTable), AND(WEEKDAY([Date],1)<> 1,WEEKDAY([Date],1)<> 7))) (Notice: 1 is Sunday, 7 is Saturday)

 

Capture2.PNG

 

I added a calculate column to show the day of week.

 

Reference:

WEEKDAY Function (DAX)

 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
ssvr
Helper III
Helper III

Hi,

DDiff.JPG

I created a Date table:

 

Dim Table=CALENDAR(DATE(2008,1,1),DATE(2018,12,31))

 

I created a new column with is working day or not

 

is work day = SWITCH(WEEKDAY([Date]),1,0,7,0,1)

 

Now I want to create "DateDifference" Column with Createddate & Closeddate (I want to know day diffarence b/w these two dates excluding weekends)

 

CreatedDate   ClosedDate  DateDiffarence

Anonymous
Not applicable

Hi sannadisarath,

 

According to your description, you want to get a date list between two dates except weekends, right?

 

If as I said, you can follow below steps:

1. Use CALENDAR function to create a datetable with two dates.

 

Dax: DateTable = CALENDAR(DATE(2010,1,1),TODAY())

Capture.PNG

 

2. Write dax formula to get the specify dates without weekends.

 

Dax: Date Except Weekends = CALCULATETABLE(DateTable,FILTER(ALL(DateTable), AND(WEEKDAY([Date],1)<> 1,WEEKDAY([Date],1)<> 7))) (Notice: 1 is Sunday, 7 is Saturday)

 

Capture2.PNG

 

I added a calculate column to show the day of week.

 

Reference:

WEEKDAY Function (DAX)

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.