
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ID | Maintenance type | Mileage | Date |
---|---|---|---|
1 | CM | 10000 | 1-1-2010 |
1 | PM | 20000 | 1-5-2010 |
1 | CM | 30000 | 1-1-2011 |
1 | PM | 40000 | 1-10-2012 |
2 | CM | 10000 | 1-1-2010 |
2 | CM | 60000 | 1-1-2012 |
2 | PM | 80000 | 1-5-2012 |
3 | CM | 10000 | 1-1-2010 |
3 | PM | 30000 | 1-5-2010 |
3 | CM | 125000 | 13-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
- Tags:
- new_to_qlikview
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
would that work ?
Loic

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With some minor tweaks your solution works perfectly! Thank you for your swift response.
