Forum Discussion
Days and hour between two dates
Hi Anonymous ,
Use the Start date and Close date as an example, you can create a calculated column like this to calculate the diff:
Diff = VAR _totalminutes = DATEDIFF ( 'Table'[Start Date], 'Table'[Close Date], MINUTE ) VAR _minutes = MOD ( _totalminutes, 60 ) VAR _hours = MOD ( DIVIDE ( _totalminutes - _minutes, 60 ), 24 ) VAR _days = DIVIDE ( _totalminutes - _minutes - _hours * 60, 24 * 60 ) RETURN _days & " days " & _hours & ":" & _minutesBest Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- amitchandak
Super User
Anonymous , Yet to check file
Try like, for days
Work Day = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(Table[Start Date],Table[End Date]),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1))
for business days
https://exceleratorbi.com.au/calculating-business-hours-using-dax/
- AnonymousNot applicable
Hi Amit,
Thanks fo your quick response but i would like to also calculate hours as well with days between tose two dates
i have tried below calculated column
NetWorkDaysHoursMinutes =VAR Calendar1 = CALENDAR(MAX(Request_Summary[RT.Act Completion Date]),MAX(Request_Summary[RT.Est Completion Date]))VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))RETURN COUNTX(FILTER(Calendar2,[WeekDay]<5),[Date]) & " Days " & HOUR(MOD(MAX(Request_Summary[RT.Act Completion Date]) - MAX(Request_Summary[RT.Est Completion Date]),1)) & " Hours " & MINUTE(MOD(MAX(Request_Summary[RT.Act Completion Date]) - MAX(Request_Summary[RT.Est Completion Date]),1)) & " Minutes"Please help me with same
If possible
- v-yingjl
Community Support
Hi Anonymous ,
Use the Start date and Close date as an example, you can create a calculated column like this to calculate the diff:
Diff = VAR _totalminutes = DATEDIFF ( 'Table'[Start Date], 'Table'[Close Date], MINUTE ) VAR _minutes = MOD ( _totalminutes, 60 ) VAR _hours = MOD ( DIVIDE ( _totalminutes - _minutes, 60 ), 24 ) VAR _days = DIVIDE ( _totalminutes - _minutes - _hours * 60, 24 * 60 ) RETURN _days & " days " & _hours & ":" & _minutesBest Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.