Forum Discussion
Duration.Seconds difference between two dates
- 6 years ago
Hi ESS ,
I think you want to calculate the difference between two dates. You can try DATEDIFF() function in the DAX.
Column = DATEDIFF ( 'Table'[taglio_data_ora_fine], 'Table'[taglio_data_ora_inizio], SECOND )
Best Regards,
Eads
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Duration.Seconds returns the duration of seconds between two 1-60 second stamps.
You see your first row thats displaying 54, there is 54 seconds between 57 and 51.
I think that you can get the correct duration if you subtract the two dates and then convert the value to seconds, (*24*60*60)
- Cmcmahan6 years agoResident Rockstar
You can read more about the Duration functions here, but the short answer is that Duration.Seconds returns the seconds portion of any duration between two dates.
You'll likely want to use Duration.TotalSeconds([taglio_data_ora_fine]-[taglio_data_ora_inizio]) to get the total number of seconds between the timestamps.
- pjg11 months agoAdvocate I
Thank you Resident Rockstar.
This works great in the Power Query transform. 👍