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

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.

Reply
learner03
Post Partisan
Post Partisan

Calculating Hours and minutes to Divide

I have a timestamp column and lines column. I need to calculate how much line been picked in the time duration.

For this I did following for calculating time difference-

DiffTime= var CurrentDate=MAX('Calender'[Date])
VAR MaxTime = CALCULATE(MAX('ULD History - Last 30 days'[Timestamp]), 'Calender'[Date] = CurrentDate)
VAR MinTime = CALCULATE(Min('ULD History - Last 30 days'[Timestamp]), 'Calender'[Date] = CurrentDate)
var Diff=DATEDIFF(MinTime, MaxTime, HOUR)
return
Diff
 
But, this only gives me first part of time, that is, 1
In actual, it is 1 hour 30 minutes.
If I am calculatingin minutes then it comes to 91 minutes and if I divide by 60 ( as  I hour has 60 minutes), then it gives me 1.51
How can I get to a stage where it divides by 1.30 as 90 minutes is 1 hour 30 minutes?

 

 

Timestamplines
30/11/2021 16:482
30/11/2021 16:482
30/11/2021 16:472
30/11/2021 16:443
30/11/2021 16:391
30/11/2021 16:391
30/11/2021 16:374
30/11/2021 16:371
30/11/2021 16:361
30/11/2021 16:341
30/11/2021 16:333
30/11/2021 16:332
30/11/2021 16:332
30/11/2021 16:282
30/11/2021 16:263
30/11/2021 16:251
30/11/2021 16:232
30/11/2021 16:222
30/11/2021 16:212
30/11/2021 16:191
30/11/2021 16:191
30/11/2021 16:174
30/11/2021 16:171
30/11/2021 16:171
30/11/2021 16:152
30/11/2021 16:122
30/11/2021 16:118
30/11/2021 16:101
30/11/2021 16:091
30/11/2021 16:091
30/11/2021 16:081
30/11/2021 16:082
30/11/2021 16:072
30/11/2021 15:571
30/11/2021 15:561
30/11/2021 15:561
30/11/2021 15:553
30/11/2021 15:532
30/11/2021 15:504
30/11/2021 15:492
30/11/2021 15:464
30/11/2021 15:452
30/11/2021 15:422
30/11/2021 15:404
30/11/2021 15:394
30/11/2021 15:391
30/11/2021 15:373
30/11/2021 15:358
30/11/2021 15:341
30/11/2021 15:332
30/11/2021 15:323
30/11/2021 15:32-3
30/11/2021 15:313
30/11/2021 15:302
30/11/2021 15:301
30/11/2021 15:294
30/11/2021 15:291
30/11/2021 15:282
30/11/2021 15:27-2
30/11/2021 15:242
30/11/2021 15:234
30/11/2021 15:172
1 REPLY 1
amitchandak
Super User
Super User

@learner03 , Ideally diff include only one side. If it always +1 , then you can try like

 

var Diff=DATEDIFF(MinTime, MaxTime, HOUR) -1

 

or

check this to

var Diff= MaxTime - MinTime

This will directly give time 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.