Forum Discussion
admi
6 years agoFrequent Visitor
Time between date
Hi, I need to get the time in minutes between two dates like this : 13/02/2020 17:04.00. The first and the last of my table. I also need to calculate the time when a parameters is null. I have a...
az38
6 years agoCommunity Champion
how do you want o calculate this 0? as current date?
if so, try to use modificated AlexAlberga727 solution
Total Time Diff =
VAR StartDate = MIN( 'Table'[StartDate] )
VAR EndDate = IF(EndDate = 0, TODAY(), MAX( 'Table'[EndDate] ))
RETURN
DATEDIFF( StartDate , EndDate , MINUTE )admi
6 years agoFrequent Visitor
Actually, I have a column for the speed and a column for the date of the data acquisiton.
| Document.Date | Speed |
| 17/02/2020 10:24 | 127 |
| 17/02/2020 10:24 | 130 |
| 17/02/2020 10:24 | 130 |
| 17/02/2020 10:24 | 130 |
| 17/02/2020 10:24 | 130 |
| 17/02/2020 10:24 | 130 |
| 17/02/2020 10:24 | 130 |
| 17/02/2020 10:24 | 90 |
| 17/02/2020 10:24 | 40 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:24 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:25 | 0 |
| 17/02/2020 10:36 | 0 |
| 17/02/2020 10:36 | 22 |
| 17/02/2020 10:36 | 45 |
I would like to know how much time the speed was 0. So, in this exemple it would be from 10:24 to 10:36. About 12 minutes.
Thanks for your help
- Anonymous6 years agoNot applicableSimply take min and max date.
Measure
Var a= calculate (min(table[date],filter(all(table),table[speed]=0))
Var b=calculate (max(table[date],filter(all(table),table[speed]=0))
Return
Datediff(a,b, minute)
Thanks
Pravin- admi6 years agoFrequent Visitor
Thanks, that works with my needs!
Document.Date Speed 17/02/2020 10:24 127 17/02/2020 10:24 130 17/02/2020 10:24 130 17/02/2020 10:24 130 17/02/2020 10:24 130 17/02/2020 10:24 130 17/02/2020 10:24 130 17/02/2020 10:24 90 17/02/2020 10:24 40 17/02/2020 10:24 0 17/02/2020 10:24 0 17/02/2020 10:25 0 17/02/2020 10:26 0 17/02/2020 10:27 0 17/02/2020 10:28 0 17/02/2020 10:29 0 17/02/2020 10:31 0 17/02/2020 10:32 20 17/02/2020 10:33 50 17/02/2020 10:34 100 17/02/2020 10:35 130 17/02/2020 10:36 0 17/02/2020 10:37 0 17/02/2020 10:38 0 17/02/2020 10:39 0 17/02/2020 10:40 0 17/02/2020 10:41 22 17/02/2020 10:42 45 In this case, your solution will just take the value 10:24 to 10:40 = 16 minutes. How can I do if I want that it doesn't take 10:32 10:33 and 10:34 and returns me the value = 13 minutes?
Thanks for your help!
- Anonymous6 years agoNot applicable
- Anonymous6 years agoNot applicableVar a=calculate (min(table[date],filter(all(table),table[speed]=0))
Var b=calculate (max(table[date],filter(all(table),table[speed]=0))
Return
Datediff(a,b,minute)
Thanks
Pravin