Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating MTBF

Hi guys,

I'm new to Qlikview, and I'm having some problems with calculating a so called MTBF (Mean time between failures).

My input data is as follows:

Loc IDMaintenance typeMileageDate
1CM100001-1-2010
1PM200001-5-2010
1CM300001-1-2011
1PM400001-10-2012
2CM100001-1-2010
2CM600001-1-2012
2PM800001-5-2012
3CM100001-1-2010
3PM300001-5-2010
3CM12500013-12-2013

Now, the MTBF is determined by taking the average of either the mileages or the days passed between 2 CM maintenances. So the PM have to be left out of the equation. For example, LOC 1 had a CM at 10000 mile at date 1-1-2010. Its next CM was done at a mileage of 30000 at 1-1-2011. This means it has an MTBF of 20000 miles or 365 days. Furthermore, the latest CM date has to be displayed for each loc. Now I've been trying to do so with the Date(Max("Date") expression, but I'm unsure on how to calculate the amount of days between 2 CM's, let alone averaging all those days into a single number (the MTBF).

Hopefully someone can be of assistance here? Just point me in the right direction!

With regards,

Stijn

1 Solution

Accepted Solutions
lft
Employee
Employee

Hi,

would that work ?

Loic

View solution in original post

3 Replies
lft
Employee
Employee

Hi,

would that work ?

Loic

martynlloyd
Partner - Creator III
Partner - Creator III

If you do this in the script, it should be a lot easier to create your chart.

To calculate days look at INTERVAL and INTERVAL#

Interval(Date1 - Date2, 'D') as Days

To calculate between current row and previous , look at PEEK .

regards,

Marty.

Not applicable
Author

With some minor tweaks your solution works perfectly! Thank you for your swift response.