Forum Discussion
Amine008
4 years agoFrequent Visitor
Calculate DATEDIFF Same column without Weekends
Hi, Please need help to exlude weekend from dates diff in the same column. The below formula works good for me and return the correct count of days. Column = VAR temp = TOPN ( 1, FILTER ( 'Cust...
- 4 years ago
This is easier if you have a date dimension table so that you can iterate over days and count them like this:
[...] RETURN COUNTROWS ( FILTER ( 'Calendar', 'Calendar'[Date] <= 'Customer visit'[DateOfVisit] && 'Calendar'[Date] > MINX ( temp, [DateOfVisit] ) && WEEKDAY ( 'Calendar'[Date] ) IN { 2, 3, 4, 5, 6 } ) )
AlexisOlson
4 years agoSuper User
This is easier if you have a date dimension table so that you can iterate over days and count them like this:
[...]
RETURN
COUNTROWS (
FILTER (
'Calendar',
'Calendar'[Date] <= 'Customer visit'[DateOfVisit]
&& 'Calendar'[Date] > MINX ( temp, [DateOfVisit] )
&& WEEKDAY ( 'Calendar'[Date] ) IN { 2, 3, 4, 5, 6 }
)
)
- Amine0084 years agoFrequent Visitor
AlexisOlson Thank you so much for your help here. Appreciate it 🙏