Forum Discussion
Time Diff between Times in the Same Column
- 8 years ago
Hi harshali,
Based on my understanding, you should be able to simply use the formula below to create a measure to calculate the Time Diff, then show the measure with defaultmachine, Canister Type Change, and Type column on the Table visual in your scenario.
Measure = DATEDIFF ( MIN ( Table1[eventdatetime] ), MAX ( Table1[eventdatetime] ), DAY )
I know you will feel confused about the solution. So please think about the formula below. :smileyhappy:
(A - B) + (B - C) + (C - D) = A - D
Hopefully it could help in your scenario.
Regards
Looks like the index numbers are not coming out consecutively as I had expected, but yes they continue over machine numbers. And there are multiple machine numbers as well. Also the unit of time of time that is produced is the number of days, correct?
Here is some more data that will hopefully help. Thanks again.
| defaultmachine | Canister Type Change | eventdatetime | Type | Index |
| 19 | Red Canister Change | 2017-08-24T11:41:50.536442 | 2 | 897101 |
| 19 | Red Canister Change | 2017-08-24T11:14:34.767856 | 2 | 897104 |
| 19 | Red Canister Change | 2017-08-24T11:08:06.70435 | 2 | 897108 |
| 19 | Red Canister Change | 2017-08-24T11:02:36.410795 | 2 | 897109 |
| 22 | Moisturizer Canister Change | 2017-08-21T16:36:25.754018 | 5 | 1008016 |
| 22 | Black Canister Change | 2017-08-21T16:32:21.265534 | 4 | 1008024 |
| 22 | White Canister Change | 2017-08-21T16:30:10.199489 | 3 | 1007984 |
| 22 | Yellow Canister Change | 2017-08-21T10:12:24.651155 | 1 | 1007967 |
| 22 | Thinner Canister Change | 2017-08-19T19:41:11.766304 | 6 | 1007992 |
| 22 | White Canister Change | 2017-08-19T16:26:02.059086 | 3 | 1007989 |
| 22 | Yellow Canister Change | 2017-08-18T17:42:35.506395 | 1 | 1007956 |
| 19 | Moisturizer Canister Change | 2017-08-15T14:41:35.408575 | 5 | 897113 |
| 19 | Thinner Canister Change | 2017-08-15T14:37:14.480917 | 6 | 897097 |
| 19 | Thinner Canister Change | 2017-08-15T14:34:14.441171 | 6 | 897096 |
| 19 | Thinner Canister Change | 2017-08-15T14:31:39.508281 | 6 | 897100 |
| 19 | Red Canister Change | 2017-08-15T14:23:36.123432 | 2 | 897105 |
| 22 | White Canister Change | 2017-08-15T12:29:17.292659 | 3 | 1007983 |
| 19 | Red Canister Change | 2017-08-14T16:09:52.640378 | 2 | 897107 |
| 19 | White Canister Change | 2017-08-14T14:10:36.358276 | 3 | 897087 |
| 19 | Moisturizer Canister Change | 2017-08-14T14:08:24.085631 | 5 | 897114 |
| 19 | Black Canister Change | 2017-08-14T14:06:09.444854 | 4 | 897118 |
| 19 | Red Canister Change | 2017-08-14T14:04:48.989088 | 2 | 897112 |
| 22 | Thinner Canister Change | 2017-08-13T15:51:37.801959 | 6 | 1007997 |
| 22 | Yellow Canister Change | 2017-08-13T14:21:57.865524 | 1 | 1007968 |
| 22 | Red Canister Change | 2017-08-12T10:03:41.946071 | 2 | 1008010 |
| 22 | White Canister Change | 2017-08-09T14:52:06.352583 | 3 | 1007986 |
| 22 | Thinner Canister Change | 2017-08-07T15:57:16.960034 | 6 | 1007996 |
| 22 | Yellow Canister Change | 2017-08-06T17:42:01.53673 | 1 | 1007971 |
| 22 | Black Canister Change | 2017-08-05T16:16:01.899794 | 4 | 1008023 |
| 22 | White Canister Change | 2017-08-02T09:23:04.430831 | 3 | 1007981 |
| 22 | Yellow Canister Change | 2017-08-01T14:39:09.391816 | 1 | 1007960 |
Hi harshali,
Based on my understanding, you should be able to simply use the formula below to create a measure to calculate the Time Diff, then show the measure with defaultmachine, Canister Type Change, and Type column on the Table visual in your scenario.
Measure = DATEDIFF ( MIN ( Table1[eventdatetime] ), MAX ( Table1[eventdatetime] ), DAY )
I know you will feel confused about the solution. So please think about the formula below. :smileyhappy:
(A - B) + (B - C) + (C - D) = A - D
Hopefully it could help in your scenario.
Regards
- harshali8 years agoFrequent Visitor
Hi,
Thank you for your help! This exact formula did not work for me as it was giving me zeros for all measure results, but I modified it by dividing the entire formula by a COUNTROWS of the table, and this ended up giving me accurate measurements.