Forum Discussion
Bharani
7 years agoRegular Visitor
Find time duration between 2 dates (Datetime format)
Hi Experts - Am new to Power BI.. Hope u can crack my query in a min... I need to calculate "Number of minutes" between 2 dates which is in Datetime format..Below date is an example.. 3/11/20...
v-piga-msft
7 years agoResident Rockstar
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
Johanno
7 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