Forum Discussion
Find time duration between 2 dates (Datetime format)
Hi Bharani,
You could try with the dax formula below to create the calculate column.
diff =
VAR tem = 'CountMinutes'[accepttime] - 'CountMinutes'[logtime]
RETURN
HOUR ( tem ) * 60
+ MINUTE ( tem )
Then you will get the output below.
Best Regards,
Cherry
- Johanno7 years agoContinued Contributor
Nice! However, that won't work when the logtime and accepttime are on different days, months or years?
- v-piga-msft7 years agoResident Rockstar
Try this formula below.
Time = VAR DIFF = 'CountMinutes'[accepttime] - 'CountMinutes'[logtime] VAR NumOfMinutes = DIFF * 24 * 60 VAR DAYS = IF ( DIFF >= 1, INT ( DIFF ), BLANK () ) VAR HOURS = INT ( ( DIFF - DAYS ) * 24 ) VAR MINUTES = NumOfMinutes - ( DAYS * 24 * 60 ) - ( HOURS * 60 ) RETURN DAYS*24*60+HOURS*60+MINUTESHere is the output.
Best Regards,
Cherry
- Bharani7 years agoRegular Visitor
Thanks!! Does it work if logtime and accepttime are on different days, months or years?
- Bharani7 years agoRegular Visitor
By the way, i get the error..
- v-piga-msft7 years agoResident Rockstar
Hi Bharani,
Do you create the calculated column with the fomula?
Could you show the detail error message?
Best Regards,
Cherry
- v-piga-msft7 years agoResident Rockstar
Hi Bharani,
Have you solved your problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, please feel free to ask.
Best Regards,
Cherry