Forum Discussion

konradjonsson's avatar
konradjonsson
Helper II
7 years ago
Solved

how to identify previous value?

I have a table that include the following columns (except the 'Days between failure', which is part of the question).

 

TypeSerial numberSold_DateService_DateFailure time (days)Days between failureProduct
Sales10012010-02-17 00:00   X
Sales10022010-05-28 00:00   X
Service10022010-05-28 00:002013-08-12 00:001172735X
Service10022010-05-28 00:002011-01-19 00:00236236X
Service10022010-05-28 00:002011-05-02 00:00339103X
Service10022010-05-28 00:002011-08-08 00:0043798X
Sales10032010-01-26 00:00   X
Service10032010-01-26 00:002010-07-08 00:00163163X
Service10032010-01-26 00:002012-09-06 00:00954791X
       
   MTTF199,5  
   MTBF 354,3 

 

In order to calculate MTBF, I need to calculate the difference (in days) between each service occasion. In other words, for each row, I need to know what the previous value was.

In the example above, the Days between failure for row three is 735 (1172 - 437).

In the example above, the MTBF is 354.3 (=average(735;236;103;98;163;791))

My question is - for each row, how to identify the previous value, for the unique serial number? (if it is the first occasion, then the previous value should be zero).

(I do not see the need to create a separate table for this purpose)

 

Regards.

  • Hi,

    This calculated column formula works

    =if(ISBLANK(LOOKUPVALUE([Failure time (days)],Data[Service_Date],CALCULATE(MAX(Data[Service_Date]),FILTER(Data,Data[Serial number]=EARLIER(Data[Serial number])&&Data[Service_Date]<EARLIER(Data[Service_Date])&&Data[Type]="Service")),Data[Serial number],Data[Serial number])),Data[Failure time (days)],Data[Failure time (days)]-LOOKUPVALUE([Failure time (days)],Data[Service_Date],CALCULATE(MAX(Data[Service_Date]),FILTER(Data,Data[Serial number]=EARLIER(Data[Serial number])&&Data[Service_Date]<EARLIER(Data[Service_Date])&&Data[Type]="Service")),Data[Serial number],Data[Serial number]))

    Hope this helps.

3 Replies