Forum Discussion
Find the difference between earliest and latest datetime
Hi,
I have a table which holds data for every part that is produced. When a part is produced, it has a date time stamp (see below):
I have then easily created a visual which shows me the earliest and latest time a part was produced, see below:
How can I calculate the minutes between the earliest and latest shot datetime?
- Anonymous4 years ago
Hi rebrow31 ,
I think you can try DATEDIFF function in your code.
Calculated column:
Column = VAR _SECOND = DATEDIFF('Table'[Earliest DateTime],'Table'[Latest DateTime],SECOND) RETURN DIVIDE(_SECOND,60)Measure:
Measure = VAR _Summarize = SUMMARIZE('Table','Table'[Earliest DateTime],'Table'[Latest DateTime],"Minute", DIVIDE(DATEDIFF('Table'[Earliest DateTime],'Table'[Latest DateTime],SECOND),60)) RETURN SUMX(_Summarize,[Minute])Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlinSuper User
([Latest DateTime]-[Earliest DateTime])*1440
- AnonymousNot applicable
Hi rebrow31 ,
I think you can try DATEDIFF function in your code.
Calculated column:
Column = VAR _SECOND = DATEDIFF('Table'[Earliest DateTime],'Table'[Latest DateTime],SECOND) RETURN DIVIDE(_SECOND,60)Measure:
Measure = VAR _Summarize = SUMMARIZE('Table','Table'[Earliest DateTime],'Table'[Latest DateTime],"Minute", DIVIDE(DATEDIFF('Table'[Earliest DateTime],'Table'[Latest DateTime],SECOND),60)) RETURN SUMX(_Summarize,[Minute])Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.