Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

calculating time differences

I need to calculate the time differences between the dispensing of any two subsequent prescriptions.  The following table illustrates the situation:

   

ScriptNumberDateTImeDispensed
16179730/01/15 18:29
16179830/01/15 18:45
16179830/01/15 18:45
16179830/01/15 18:45
16179930/01/15 18:49
16180031/01/15 08:18
16180031/01/15 08:18
16180131/01/15 08:39
16507327/03/15 07:44
16180231/01/15 09:14
16180331/01/15 09:38
16180431/01/15 09:41
16180431/01/15 09:41
16180431/01/15 09:41
16180531/01/15 09:48
16180631/01/15 09:55
16180631/01/15 09:55
16180631/01/15 09:55
16180731/01/15 10:03
16180831/01/15 10:19
16180931/01/15 10:21
16181031/01/15 10:22
16181031/01/15 10:22
16181131/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?

13 Replies
Anonymous
Not applicable
Author

Many thanks Petter, changing expression worked.  How can i show the average time difference?

Regards

Anonymous
Not applicable
Author

Many thanks Massimo, comments noted.

Regards

pratap6699
Creator
Creator

show me the all expressions dispences,days also

petter
Partner - Champion III
Partner - Champion III

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)