Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rebrow31
Helper I
Helper I

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):

 

rebrow31_1-1643889096265.png

 

I have then easily created a visual which shows me the earliest and latest time a part was produced, see below: 

 

rebrow31_2-1643889174928.png

 

How can I calculate the minutes between the earliest and latest shot datetime?

 

 

1 ACCEPTED SOLUTION
Anonymous
Not 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.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not 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.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

([Latest DateTime]-[Earliest DateTime])*1440

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.