Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there !
I am trying to find the diff b/w these 2 columns . The output should be in datetime.
Ultimate goal is to show time difference as x days y hours z minutes w seconds format as the difference.
Is there a DAX function available for the same ?
DATEDIFF only gives one value based on HOUR, MINUTES, SECONDS that needs to be modified to finally achieve the above goal.
Can anyone help me with this?
Solved! Go to Solution.
Hi, @A123-Chauhan
You need to create multiple calculated columns to obtain results at each time granularities, and then concatenate the results.
Duration in Seconds = DATEDIFF('Table'[Datetime1],'Table'[Datetime2],SECOND)
_day = INT('Table'[Duration in Seconds]/(3600*24))
_hour = INT( MOD('Table'[Duration in Seconds],(3600*24))/3600)
_minute = INT(MOD(MOD('Table'[Duration in Seconds],(3600*24)),3600 )/60)
_second = MOD(MOD(MOD('Table'[Duration in Seconds],(3600*24)),3600 ),60)
diff = 'Table'[_day] &" days "&'Table'[_hour]&" hours "&'Table'[_minute]&" minutes "&'Table'[_second]&" seconds"
Result:
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @A123-Chauhan
You need to create multiple calculated columns to obtain results at each time granularities, and then concatenate the results.
Duration in Seconds = DATEDIFF('Table'[Datetime1],'Table'[Datetime2],SECOND)
_day = INT('Table'[Duration in Seconds]/(3600*24))
_hour = INT( MOD('Table'[Duration in Seconds],(3600*24))/3600)
_minute = INT(MOD(MOD('Table'[Duration in Seconds],(3600*24)),3600 )/60)
_second = MOD(MOD(MOD('Table'[Duration in Seconds],(3600*24)),3600 ),60)
diff = 'Table'[_day] &" days "&'Table'[_hour]&" hours "&'Table'[_minute]&" minutes "&'Table'[_second]&" seconds"
Result:
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Referring to this thread
https://community.powerbi.com/t5/Desktop/Calculating-day-time-difference/m-p/321189
Did I answer your question? If so, please mark my post as a solution!
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |