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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
v-rzhou-msft
Community Support
Community Support

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
v-rzhou-msft
Community Support
Community Support

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.