Forum Discussion
Nitin03
3 years agoFrequent Visitor
How to find difference between two dates in hours.
Hi
I am new to Dax. I want find difference between two dates in hours. I tried by using DATEDIFF function but it is excluding minutes
I want result like this
Is there another way to solve this probem.
amitchandak
Hi,
You need to calc the Hour and Minutes separately, then add the particular text Hr and Min to the text one.
use the below code for your measure :
DateDiffInHour = CONCATENATE(CONCATENATE(DATEDIFF( values(Sheet244[In Time]), values(Sheet244[Out Time]),hour), " hr "),CONCATENATE( mod( DATEDIFF( values(Sheet244[In Time]), values(Sheet244[Out Time]), minute), 60)," min"))
3 Replies
- MahyarTF
Memorable Member
Hi
did you use the Interval in your dax :
DateDiffInHour = DATEDIFF( values(Sheet244[In Time]), values(Sheet244[Out Time]),HOUR)Appreciate your Kudos and please mark my response as a solution if it helps you
- MahyarTF
Memorable Member
Hi,
You need to calc the Hour and Minutes separately, then add the particular text Hr and Min to the text one.
use the below code for your measure :
DateDiffInHour = CONCATENATE(CONCATENATE(DATEDIFF( values(Sheet244[In Time]), values(Sheet244[Out Time]),hour), " hr "),CONCATENATE( mod( DATEDIFF( values(Sheet244[In Time]), values(Sheet244[Out Time]), minute), 60)," min"))