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: 
Not applicable

difference between Max date corresponding value and second max corresponding value?

Hi All,

I have below data

EngineDateHrs
A11/3/2014 15:0015
A11/3/2014 15:2015
A11/2/2014 12:0010
B20/1/2014 06:0020
B12/2/2014 12:0025
B10/3/2014 7:2330

Formula: Hrs=(max date corresponding hrs-2nd max date corres Hrs) /(max date-2nd max date)

Ex: Engine A=(15-15)/(11/3/2014-11/3/2014)

Engine B=(30-25)/(10/3/2014-12/2/2014)

                =5/28.

Numarator: Hrs difference

Dinaminator: Days difference.

I need to calculate this in back end because in chart i need to show in year and month wise.

Date means service date

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Straight table:

Dimension: Engine

Expression: =(FirstSortedvalue(Hrs, -Date) -FirstSortedvalue(Hrs, -Date, 2))/ (Max(Date) -max(Date,2))

View solution in original post

1 Reply
tresesco
MVP
MVP

Straight table:

Dimension: Engine

Expression: =(FirstSortedvalue(Hrs, -Date) -FirstSortedvalue(Hrs, -Date, 2))/ (Max(Date) -max(Date,2))