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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

subtract time in same date field

hi,

i have scenario having date field and phone numbers repeating thrice/ 4 times, i want to find interval between each of them; how can i find it in same date column and show them in chart

table format:

phno                                time

1234567890                     3/4/2013 08:00:00

1234567890                      3/5/2013  09:00:00

1234567890                       3/5/2013 15:00:22

5 Replies
Not applicable
Author

can you please provide the sample expected output

Anonymous
Not applicable
Author

It is something like want to show bars for 3/4 times for same ph no and showing time between them as trend

Anonymous
Not applicable
Author

try this:

load the table grouped by phone number.

in your table, add this field:

if(phno <> peek (phno,-1), 0, calltime - peek(calltime, -1)) as difference

in a bar chart, use phno and calltime as dimensions and sum(difference) as expression.

maxgro
MVP
MVP

below you find the script to generate interval;

my date format is SET DateFormat='DD/MM/YYYY';

I don't understand the chart you would like to have

load

phno,

time,

if(phno<>peek(phno), null(), interval(time - peek(time), 'DD HH mm ss')) as timediff,

if(phno<>peek(phno), null(), interval#(time - peek(time))) as timediff2;

LOAD * INLINE [

phno        ,                        time

1234567890       ,3/4/2013 08:00:00

1234567890       ,3/5/2013 09:00:00

1234567890       ,3/5/2013 15:00:22

];

Not applicable
Author

Hey Praveena,

Check out the attached doc and see if it helps.

Thanks

AJ