Forum Discussion
jgarcin8
4 years agoFrequent Visitor
Get the difference between 2 dates excluding weekends. Storage Mode: Direct Query
Hello, Im trying to calculate the difference in days between 2 dates: 'SubmittedDate' and 'LastModifiedDate' excluding weekends. I have 2 sql tables here: *Table 'Query1' in which I ha...
- 4 years ago
Try this and see if it works (as column)
Working Days Calc = DateDiff ('Query1'[SubmittedDate], 'Query1'[LastModifiedDate], Day) - ( CALCULATE ( countrows('Query2'), 'Query2'[IsWeekDay] = FALSE(), DatesBetween('Query2'[Date], 'Query1'[SubmittedDate], 'Query1'[LastModifiedDate] - 1) ) )Other way (simplified)
Working Days Calc = CALCULATE ( COUNTROWS('Query2'), DatesBetween('Query2'[Date], 'Query1'[SubmittedDate], 'Query1'[LastModifiedDate] - 1), 'Query2'[IsWeekDay] = FALSE(), All('Query2') )The only thing you may need to consider based on your requirement is to do "-1", to include the end day or not, depends on your requirements
jgarcin8
4 years agoFrequent Visitor
Hi
I changed the Dashboard to "Import mode" and the formula works!
Thank you so much!
sevenhills
4 years agoSuper User
Glad it worked in the end!
... sorry somtimes if we dont have code and error reproduce, it is tough ...