Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to calculate the time differences between the dispensing of any two subsequent prescriptions. The following table illustrates the situation:
| ScriptNumber | DateTImeDispensed |
| 161797 | 30/01/15 18:29 |
| 161798 | 30/01/15 18:45 |
| 161798 | 30/01/15 18:45 |
| 161798 | 30/01/15 18:45 |
| 161799 | 30/01/15 18:49 |
| 161800 | 31/01/15 08:18 |
| 161800 | 31/01/15 08:18 |
| 161801 | 31/01/15 08:39 |
| 165073 | 27/03/15 07:44 |
| 161802 | 31/01/15 09:14 |
| 161803 | 31/01/15 09:38 |
| 161804 | 31/01/15 09:41 |
| 161804 | 31/01/15 09:41 |
| 161804 | 31/01/15 09:41 |
| 161805 | 31/01/15 09:48 |
| 161806 | 31/01/15 09:55 |
| 161806 | 31/01/15 09:55 |
| 161806 | 31/01/15 09:55 |
| 161807 | 31/01/15 10:03 |
| 161808 | 31/01/15 10:19 |
| 161809 | 31/01/15 10:21 |
| 161810 | 31/01/15 10:22 |
| 161810 | 31/01/15 10:22 |
| 161811 | 31/01/15 10:28 |
| 161811 | 31/01/15 10:28 |
The ScriptNumber is a unique identifier of a prescription. How do i calculate the time difference between any two prescriptions?
Many thanks Petter, changing expression worked. How can i show the average time difference?
Regards
Many thanks Massimo, comments noted.
Regards
show me the all expressions dispences,days also
You can add a measure with the expression:
Avg(DateTimeDispensed) and label it AvgDisp
Then one more expression like this:
AvgDisp-Above(AvgDisp)
If you want it compared to the average of all then use:
Avg(TOTAL DateTimeDispensed)