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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jmontes1810
Frequent Visitor

How can I create a column with a datedif only between working days?

I want to create a column that is a DateDif between today (current day) and another column of random dates (X column) without including weeknds (Saturday & Sunday). 
For example, if today 05/20/2021

X ColumnDateDif vs Current day (wo Saturday and Sunday)
05/21/20211
05/24/20212
05/25/20213
05/31/20217

 How can I create this DateDif Column?

As an extra info, X Column never is going to have a date on Saturday or Sunday.
I hope you can help me, and thnks in advantage,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jmontes1810 ,

 

You can simply use datediff minus weekdiff*2.

Check the formula, today() is 5/25/2021.

Column = DATEDIFF(TODAY(),'Table'[X Column],DAY)-(WEEKNUM('Table'[X Column])-WEEKNUM(TODAY()))*2

11.PNG

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @jmontes1810 ,

 

You can simply use datediff minus weekdiff*2.

Check the formula, today() is 5/25/2021.

Column = DATEDIFF(TODAY(),'Table'[X Column],DAY)-(WEEKNUM('Table'[X Column])-WEEKNUM(TODAY()))*2

11.PNG

 

Best Regards,

Jay

themistoklis
Community Champion
Community Champion

@jmontes1810 

 

Maybe this post will help you:

https://community.powerbi.com/t5/Desktop/DATEDIFF-excluding-weekends/m-p/947915

 

or 

 

Create a new column

IsWeekend =IF(WEEKDAY('Table'[Date],2)>5,FALSE,TRUE)

 

and then the datediff calculation will be the following

Difference = 

DATEDIFF([StartDateTime],[EndDateTime], DAY) - ( CALCULATE ( COUNTROWS('Table'), 'Table'[IsWeekend] = TRUE(), DATESBETWEEN('Table'[Date], [StartDateTime],[EndDateTime]) ) )

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.