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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
josevarelac
Frequent Visitor

Calculate Mean Time Before Failure (MTBF) in different period of time

Hello, again. I´m here with a task that i want to do in Power BI. Now im having troubles with using DAX to soleve the following task.

 

Goal:

 

I need to obtain the Mean Time Before Failure (MTBF) of a machine or system on any period of time.

 

Backgrounds:

 

I´ve been looking for different topics or post that can give me some ideas of getting the task done. First, i seen a very good post of this topic. In that post you can find a very good picture os the MTFB indicator. The author use EARLIER() function to get the job done. Here is the link of the post:

 

https://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339... 

 

Unlike the author, i need to use a "flexible" range of date. Being able to compare different dates mixing the dates on tables and calendar. Below is a full explanation of the idea.

 

Idea and Data:

 

My date is constructed in the following form where:

 

1.- Table named Test that has the information of failure of the machine, the descripction of the columns are the following:

 

Machine: Type of machine.

Stop Date: Date when the machine stop working.

Repair Date: Date shen the machine was repair.

Operation: The machine operating time.

 

MachineStop DateRepair DateOperation
A10-09-2019 14:2012-09-2019 15:3024
A15-10-2019 10:3220-10-2019 4:3024
A11-11-2019 11:1111-11-2019 12:3024
B12-07-2019 12:4514-07-2019 12:5624
B18-09-2019 12:0101-10-2019 0:0024
B02-10-2019 12:3410-10-2019 4:5024
B12-11-2019 17:5015-11-2019 0:0024

 

2.- Table T, is a table that has the dates between first detention date and today:

 

T = CALENDAR(min(Test[Fecha Detención]);today())
VAR Fi = CALCULATE ( MIN ( T[Date] ); ALLSELECTED ( T[Date]) )
VAR Ft = CALCULATE ( MAX ( T[Date] ); ALLSELECTED ( T[Date]) )
 

I need to get the MTBF respect 2 given dates; Fi= Inicial date of evaluation and Ft=Final date of evaluation. So it is possible to be that <Fi < Stop Date> and <Ft > Repair Date> or any logical combination..  In the link that i showned before, the author don´t consider using Fi or Ft as "external" dates. That my main difference that i need to apply. So in order to extract MTBF i need to get the sum per machine, of all the times that the machine was on during Fi and Ft, considering the breakdowns.

 

MTBF is a function of Fi and Ft.

 

MTBF(Fi,Ft)= Sum of time that making was on during Fi and Ft/ Count of failures during Fi and Ft.

 

Taking that in mind,the scenarios/combination between Fi,Ff, Fd and Fr, i´ve describe the cases:

 

Fi = Initial date of evaluation

Ff = Final date of evaluation

Fd = Date of Detention

Fr =  Date of Repair

 
 
1) Fi<=Ft&&Fi<=Fd&&Fi<=Fr&&Ft<=Fr&&Ft<=Fd the Time of Functioning = 24*(Ft-Fi)
The fail pas before the evaluation period. So the making is working on the evaluation.
2)Fi<=Ft&&Fi<=Fd&&Fi<=Fr&&Ft<=Fr&&Ft>=Fd the Time of Functioning = 24*(Fd-Fi);
Fi is before the detention date (Fd) and Ft is before Repair time so the working time is the difference of: Fd-Fi.
3)Fi<=Ft&&Fi<=Fd&&Fi<=Fr&&Fd<=Ft&&Fr<=Ft the Time of Functioning = 24*(Fi-Fd+Ft-Fr);
The period of evaluation contains Fd and Ft or the fail pass in the time of evaluation, the Time working is = Fi-Fd+Ft-Fr.
4)Fi<=Ft&&Fd<=Fi&&Fr<=Fi&&Fd<=Ft&&Fr<=Ft the Time of Functioning = 24*(Ft-Fi);
The evaluation dates pasess before the fail, so the uptime is Ft-Fi.
5)Fi<=Ft&&Fd<=Fi&&Fi<=Fr&&Fd<=Ft&&Fr<=Ft the Time of Functioning =24*(Ft-Fr);0
The  Fd pases before Fi and the makin was fixed before Ff so time = Ft-Fr.
 
 There is an image of those cases:
Captura.PNG
 Case 1=a, 2=b, 3=c, 4=d and 5=e
 
The result is multiply be 24 cuz i want the time in hours. Also i need to be aware of the time that the machine is on between fails. 
Examples:
 
Here are 2 examples with different cases.
 
Nro 1:
 

Nro 2:

mtbf2.JPG

 

 

That my need, any help that you can share it is greatly apreciated.

 

Thank to all the comunity

Jose.

1 REPLY 1
josevarelac
Frequent Visitor

The image of the 1st case didn´t upload. Here is the image.

mtbf1.JPG

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.