cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Anonymous
Not applicable

## MTBF implementation for Service Now

Hi All,

I am stuck in a situation where I have service Now (SNOW) data for P1,P2 and want to calculate MTBF based upon the assignment group.But confused about the situation when we have only one incidence for a particular assignment group.I want to calculate the days ;if there is no other incidence then it should give the difference of today date and creation date.So far I have written this DAX code to calculate this logic.

MTBFCount = If((MAX([Created]) && max([Priority])="1 - Critical" ||Max([Priority])="2 - High" ), DateDiff(MAX([2nd_highestvalue]),MAX([Created]),DAY),0)

2nd_highestvalue = CALCULATE(MAX('INC Overview'[Created]),FILTER('INC Overview', EARLIER('INC Overview'[Priority])='INC Overview'[Priority] && EARLIER('INC Overview'[Created])>'INC Overview'[Created] && EARLIER('INC Overview'[Assignment group])='INC Overview'[Assignment group]))

Note:: I have also using another calculated column '2nd_highestvalue' which is giving me the second latest creation date of that priority incidence and for that assignment group.

'INC Overview' is the table.

So can u please guide me to embed  the logic (if there is no other incidence then it should give the difference of today date and creation date)

Also how I can take the average  days of that;again classifoication should be the priority and assignment group.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

In my case the above solution did not work.I tried with another solution.

I created a Row count column as below which groupe the data based upon the Assignment group and priority and gives the count of this .

Row_counts = CALCULATE(COUNTROWS('INC Overview'),ALLEXCEPT('INC Overview','INC Overview'[Priority],'INC Overview'[Assignment group]))

then I created another column let say Avg_MTBF which calculated the time between two failure of incidences and also cover those cases where we recieved only one incidence (in that case it will give the difference between today date and the day when it was occurred.)

Avg_MTBF = If(([Row_counts]>1 && [2nd_highestvalue] <>BLANK()), DateDiff([2nd_highestvalue],[Created],DAY),
IF([Row_counts]=1 && [2nd_highestvalue] =BLANK(),ABS(DateDiff(TODAY(),[Created],DAY)),0))

6 REPLIES 6
Employee

Hi @Anonymous,

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

In my case the above solution did not work.I tried with another solution.

I created a Row count column as below which groupe the data based upon the Assignment group and priority and gives the count of this .

Row_counts = CALCULATE(COUNTROWS('INC Overview'),ALLEXCEPT('INC Overview','INC Overview'[Priority],'INC Overview'[Assignment group]))

then I created another column let say Avg_MTBF which calculated the time between two failure of incidences and also cover those cases where we recieved only one incidence (in that case it will give the difference between today date and the day when it was occurred.)

Avg_MTBF = If(([Row_counts]>1 && [2nd_highestvalue] <>BLANK()), DateDiff([2nd_highestvalue],[Created],DAY),
IF([Row_counts]=1 && [2nd_highestvalue] =BLANK(),ABS(DateDiff(TODAY(),[Created],DAY)),0))

Employee

Thank you very much for sharing with the community. @Anonymous

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Solution Sage
Assuming second higher last value is blank if there is only one

MTBFCount = VAR CompareDate = IF([2nd_highestvalue],max([2nd_highestvalue]),TODAY()) RETURN
If((MAX([Created]) && max([Priority])="1 - Critical" ||Max([Priority])="2 - High" ), DateDiff(CompareDate,MAX([Created]),DAY),0)
Anonymous
Not applicable

Hi,

Really thanks for your prompt help.

However when I am using this as a cal measure then its giving me the below errorcalc_measure errorand when I am trying to create a calc column then it is calculating all the values zero;which make no sense to me.

Please can you suggest what could be the best way to handle this.

Solution Sage
Sorry Saines your second highest measure returned a distinct value. Just wrap the test for the second highest value in a max or any other aggregate function in both the terms of the VAR MAX([2nd_highestvalue]),

The reason it didn’t work as a calc column is that the filter context is limited to that row unless you use EARLIER or something to expand it so there is never a second higher at value for a single row.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors