Forum Discussion
Calculating availability
Hi Azucrinador ,
You can refer the following links to get it:
Service Availability: Calculations and Metrics, Five 9s, and Best Practices
Calculating Availability (duration as a percentage of time range)
date range =
VAR startdate =
MIN ( 'Date'[Date] )
VAR enddate =
MAX ( 'Date'[Date] )
RETURN
DATEDIFF ( startdate, enddate, DAY ) + 1
percentage =
VAR startdate =
MIN ( 'Date'[Date] )
VAR enddate =
MAX ( 'Date'[Date] )
VAR lostdate =
SELECTEDVALUE ( data[lostservice] )
VAR regaineddate =
SELECTEDVALUE ( data[regainedservice] )
RETURN
IF (
lostdate >= startdate
&& regaineddate <= enddate,
DATEDIFF ( lostdate, regaineddate, DAY ),
IF (
lostdate >= startdate
&& lostdate <= enddate
&& regaineddate >= enddate,
DATEDIFF ( lostdate, enddate, DAY ),
IF (
lostdate < startdate
&& regaineddate <= enddate
&& regaineddate >= startdate,
DATEDIFF ( startdate, regaineddate, DAY ),
IF (
lostdate < startdate
&& regaineddate > enddate,
DATEDIFF ( startdate, enddate, DAY ),
BLANK ()
)
)
)
)
/ [date range]
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- Azucrinador3 years agoRegular Visitor
Hi Rena, good afternoon! Thank you for the reply, here is a sample of what I've already done which gives me the availability time within 30 days,
In your case above you use the difference between 2 dates to calculate the availability, right? In my case, the date where the service was recovered is not the correct information, needing to be calculated with the "tempo aberto" which is the period the service was off.
Here is the formula used "SLA = ((SUM(Enel[TEMPO ABERTO])-43200)/43200)*-1" Tempo aberto = The period the service was having a failure.
In my case, we assume that the service should be running 24/7, and we deduct the time it had a failure (in minutes) to get the service availability, example below:This is the information I get by using the formula, which gives me the availability for 30 days, but I need to be able to make it calculate month by month, like, February has 28 days, so the availability will be calculated in this period.
Can it be done in a single formula?