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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Partner - Master
Partner - Master

create min&max timestamp

Hi,

I have problem to create min and max timestamp. My rawdata looks like this.

expected below, I can not use a min and max and do a Group by on Dimension because all dimension will be repeated.

This has to be done in the load script.

   

dimensionminmax
44-1502017-08-25 11:00:002017-08-25 11:01:59
50-1002017-08-25 11:02:592017-08-25 11:05:59
63-1252017-08-25 11:06:592017-08-25 11:08:59
50-1002017-08-25 11:09:592017-08-25 11:10:59
63-1252017-08-25 11:11:59

2017-08-25 11:13:59

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Staffan,

try like this

LOAD *,If(Peek(Dimension)=Dimension,Peek(Counter),RangeSum(Peek(Counter),1)) as Counter

From Table;

Than LOAD Min and Max Grouped By Counter.

Regards,

Antonio

View solution in original post

6 Replies
vinieme12
Champion III
Champion III

LOAD Dimension,

     Min(Time) as MinTime,

     Max(Time) as MaxTime

From XXXX

Group by Dimension;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
stabben23
Partner - Master
Partner - Master
Author

Hi Vineeth,

as I said, this will not work, for ex this will give me one row on 50-100 With MinTime 2017-08-25 11:02:59 and MaxTime 2017-08-25 11:10:59 that is not correct.

antoniotiman
Master III
Master III

Hi Staffan,

try like this

LOAD *,If(Peek(Dimension)=Dimension,Peek(Counter),RangeSum(Peek(Counter),1)) as Counter

From Table;

Than LOAD Min and Max Grouped By Counter.

Regards,

Antonio

stabben23
Partner - Master
Partner - Master
Author

Hi Antonio,

YES, this will create a Group of all Dimension and add a Field that can be used as a keyfield, thanks.

I will test this in my script and comes back to you.

its_anandrjs
Champion III
Champion III

Try this way also

LOAD

dimension,

TimeStamp( Min(Num(Time)) )   as Min_Time,

TimeStamp( Max(Num(Time)) )  as Max_Time

From Source

Group by dimension;

stabben23
Partner - Master
Partner - Master
Author

Hi Anand,

thanks but this is not working as I said. to do a Group by only on Dimension will gives me 3 rows instead of 5.

antoniotiman‌ has solve this for me.