Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
1adam_haj
New Contributor III

Interval over the line

How to deal with wrong format of data ?

I have a table like this

Time 1Time 2Interval
2.1.2017 20:002.1.2017 21:00Interval between Time2-and UpperTime1
1.1.2017 20:001.1.2017 21:00Interval between Time2-and UpperTime1

How can i calculate Interval between Time 2 ( Lower line )  and Time 1 ( Upper line  )

Thnaks in advance

Tags (2)
1 Solution

Accepted Solutions
felipedl
Valued Contributor III

Re: Interval over the line

Hi Adam,

You can do something like:

dummy:

Load * Inline

[

Time 1, Time 2, Interval

2.1.2017 20:00, 2.1.2017 21:00, Interval between Time2-and UpperTime1

1.1.2017 20:00, 1.1.2017 21:00, Interval between Time2-and UpperTime1

];

data:

Load

*,

[Formated Time 2] - peek([Formated Time 1]) as Difference;

Load

RecNo() as Index,

date#([Time 1],'M.D.YYYY hh:mm') as [Formated Time 1],

date#([Time 2],'M.D.YYYY hh:mm') as [Formated Time 2]

Resident dummy;

This gives the following result:

Sample.png

Felipe.

4 Replies
felipedl
Valued Contributor III

Re: Interval over the line

Hi Adam,

You can do something like:

dummy:

Load * Inline

[

Time 1, Time 2, Interval

2.1.2017 20:00, 2.1.2017 21:00, Interval between Time2-and UpperTime1

1.1.2017 20:00, 1.1.2017 21:00, Interval between Time2-and UpperTime1

];

data:

Load

*,

[Formated Time 2] - peek([Formated Time 1]) as Difference;

Load

RecNo() as Index,

date#([Time 1],'M.D.YYYY hh:mm') as [Formated Time 1],

date#([Time 2],'M.D.YYYY hh:mm') as [Formated Time 2]

Resident dummy;

This gives the following result:

Sample.png

Felipe.

eduardo_dimperi
Valued Contributor II

Re: Interval over the line

Hi Adam,

Try this

Interval ([Time 2] - [Time 1]) AS Time_Between

Interval – função de script e gráfico ‒ Qlik Sense

1adam_haj
New Contributor III

Re: Interval over the line

Load

RecNo() as Index,

date#([Time 1],'M.D.YYYY hh:mm') as [Formated Time 1],

date#([Time 2],'M.D.YYYY hh:mm') as [Formated Time 2]

Resident dummy;

worked good but

[Formated Time 2] - peek([Formated Time 1]) as Difference;


is not giving any result. I tried to nest it in the Interval but nothing, it didnt worked even without the peek function

1adam_haj
New Contributor III

Re: Interval over the line

Ok i find it out, It worked when i Deleted the # from dates Thank you very much