Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate a number of rows / seconds ratio

Hi guys

I would like to calculate per session a ratio "number of rows / second", i have 4 columns  in my set of data.

- SESSION_ID (integer)

- SESSION_START_TIME (timestamp)

- SESSION_END_TIME (timestamp)

- SESSION_SUCCESSFUL_ROWS (integer)

when i try to calculate in an expression this ratio, i have wrong result using this formula :

=SESSION_SUCCESSFUL_ROWS / INTERVAL(NUM(SESSION_END_TIME) - NUM(SESSION_START_TIME),'s')

Thanks for your help

JP

1 Solution

Accepted Solutions
swuehl
MVP
MVP

The interval() function will only format the time difference in seconds, the internal numerical representation is still fraction of days.

Try something like

(SESSION_END_TIME-SESSION_START_TIME) / maketime(0,0,1)

to calculate the amount of seconds.

I assume you are using your expression in the context of SESSION_ID (like using SESSION_ID as dimension in a chart), right?

View solution in original post

2 Replies
swuehl
MVP
MVP

The interval() function will only format the time difference in seconds, the internal numerical representation is still fraction of days.

Try something like

(SESSION_END_TIME-SESSION_START_TIME) / maketime(0,0,1)

to calculate the amount of seconds.

I assume you are using your expression in the context of SESSION_ID (like using SESSION_ID as dimension in a chart), right?

Not applicable
Author

Thanks for your help.

Yes You're right !

Your formula to calculate the amount of seconds works fine.