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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Straight table:

Dimension: Engine

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

View solution in original post

1 Reply
tresB
Champion III
Champion III

Straight table:

Dimension: Engine

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