Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
simongoodman
Creator
Creator

trying to create a date field from others selecting the newest date

In the DB data table there are a number of date fields,each representing a date action. I would like to create a 'final date field' that picks the newest date from those date fields, by row. If I was using excel I would use =IF(SUM(H2:K2)=0,"",MAX(H2:K2)).

Next I would like to create another column that calculates the length of time from when a record was created against the 'final date field'. The created record field is timestamped but the others do not seem to be.

1 Solution

Accepted Solutions
Anonymous
Not applicable

Simon,

In your case, it may be something like this:
interval(FinalDate-CreateDate, 'D hh:mm ')      // format in days, hours, minutes
or, if you have to define final Date right here:
interval(rangemax(Date1,Date2,Date3)-CreateDate, 'D hh:mm ')

Regards,
Michael
PS: See examples in "help".

View solution in original post

4 Replies
Anonymous
Not applicable

Simon,


Function rangemax(field1,field2,field3,...) is what you need to get the latest date from the different fields.

Lenngth of time will be the difference between the final date and the create date.  Function interval() may be helpful.

Regards,
Michael

simongoodman
Creator
Creator
Author

Michael

Thanks the rangemax makes sense. Also I can see how to create an expression

in a chart. But I am still fairly new to Qlikview and have not used the

function interval(), could you please give me an example to look at.

Regards

Simon

On 1 May 2012 17:03, "Michael Solomovich" <

Anonymous
Not applicable

Simon,

In your case, it may be something like this:
interval(FinalDate-CreateDate, 'D hh:mm ')      // format in days, hours, minutes
or, if you have to define final Date right here:
interval(rangemax(Date1,Date2,Date3)-CreateDate, 'D hh:mm ')

Regards,
Michael
PS: See examples in "help".

simongoodman
Creator
Creator
Author

Many thanks for the quick help.