Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

How to calculate seconds diff.

Hi All,

I Load the sample data this way and want to get difference in the seconds how can i do this in script in place of this

Interval( [Close Date Time] - [Create Date Time], 'DD' )  want to get seconds difference in script and then average.

LOAD

*,

Interval( [Close Date Time] - [Create Date Time], 'DD' )  AS DiffDays

FROM DataSource;


Now in front end just use

Sum(DiffDays)/Count(Id)


And calculate Average in bar chart this way.


Dim : Region

Expression :- Sum(DiffDays)/Count(Id)


Note:- Here my question is what is the unit of measurement of this average calculation in expression.


I attached the sample data.


Any one reply on this.


Thanks,

Bosc


2 Replies
Not applicable

Re: How to calculate seconds diff.

Use Seconds parameter like below:

Method1:

Num#(Text#(Interval([Close Date Time] - [Create Date Time] , 's')))

The above purely convert interval value into string & then Num

Method2:

( Num([Close Date Time]) - Num([Create Date Time]))*86400

Not applicable

Re: How to calculate seconds diff.

I attached the sample data file please check.

Bosc

Community Browser