Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
katchow002
New Contributor III

How to get maximum and minimum timestamp?

Hey guys! I have a Start Date and End Date which has Start time and End time respectively. My task is to get the minimum and maximum timestamp for each outage, excluding Duration Type and Major Event Day (MED).

Here's how my data set looks like:

1.PNG

I tried min(timestamp#([Start Date],[Start Time],[Outage ID])) and max(timestamp#([Start Date],[Start Time],[Outage ID])) to no avail. I am a QlikView newbie so I'm sorry if I missed something obvious and thanks for your response in advance.

16 Replies
MVP
MVP

Re: How to get maximum and minimum timestamp?

Search for FirstSortedValue function

gerry_hdm
Contributor II

Re: How to get maximum and minimum timestamp?

Firstsortedvalue

lastsortedvalue

by Group statement

katchow002
New Contributor III

Re: How to get maximum and minimum timestamp?

Sir, do I write this in the Load Script or in the Expression tab?

gerry_hdm
Contributor II

Re: How to get maximum and minimum timestamp?

by load script

gerry_hdm
Contributor II

Re: How to get maximum and minimum timestamp?

MYTimestamp:

load OutageID,

firstsortedvalue(Timestamp) as FirstTimestamp,

firstsortedvalue(Timestamp) as FirstTimestamp

resident yourtable

group by OutageID

;

gerry_hdm
Contributor II

Re: How to get maximum and minimum timestamp?

Greetings Gerold

olivierrobin
Valued Contributor II

Re: How to get maximum and minimum timestamp?

hello

for me , lastsortedvalue doesn't exist (that would be a good idea)

so i think you mean

MYTimestamp:

load OutageID,

firstsortedvalue(Timestamp,Timestamp) as FirstTimestamp,

firstsortedvalue(Timestamp,-Timestemp) as LastTimestamp

resident yourtable

group by OutageID

;

gerry_hdm
Contributor II

Re: How to get maximum and minimum timestamp?

you can create a test.qvw ?

Re: How to get maximum and minimum timestamp?

Would you be able to provide the Excel file above and also provide the expected output?