Measure SLA less than 0 in all SLA status

Hi everyone,

I need to measure all SLA less than 0, to calculate the SLA breached not only when it will be completed, but all status of SLA.
I tried javascript but doesn’t work. I tried like below:

[jira.customfield_rst_break]
name = "RST Break"
data_type = "string"
dimension = true
javascript_code = '''
if (issue.fields.customfield_13227 < "0h 0m")
{
  issue.fields.customfield_rst_break = "YES";
}
else
{
issue.fields.customfield_rst_break = "NO";
}
'''

Every time we had NO in this case.

Hi @Luiz_Junior,
Do you have a Jira Service Management project?
In that case, you should be able to use the predefined “SLA state” dimension to filter out issues that are now breached, see more here.
And if you want to know which are still running, you can add SLA state dimension to the report:

Kind regards,
Gerda

Hi @gerda.grantina, thanks for the answer.
We solve the issue using this code

Hi @Luiz_Junior
Glad to hear that you found the formula that works for you, just a suggestion - you don’t need to use the Aggregate() function.
It is enough with this tuple, also you can improve the formula to avoid dividing by zero with CASE WHEN.
This would be the final formula:

CASE WHEN
[Measures].[Issues created]>0
THEN
1 -(([Measures].[Issues created],[RST - Resolution Time Breached].[Breached])
/
[Measures].[Issues created])
END

best,
Gerda // support@eazyBI.com

1 Like

@Luiz_Junior and I just realized that you can actually use the default measure that is available in eazyBI “SLA - Met %” - Jira Service Management custom fields
It will show percentage met for all issues where the SLA measures is available.

best,
Gerda

Hi @gerda.grantina
I tried this way but the number doesn’t work, I believe that in this case it’s for SLA closed date and not for created or resolved

The calculation uses only those measures where is SLA applied. Could it be that some of the “Issues created” doesn’t have the SLA?

Here is the formula behind “SLA met %”:

CASE WHEN [Measures].[Time to resolution Issues] > 0 THEN
  CoalesceEmpty([Measures].[Time to resolution - Met], 0) /
  [Measures].[Time to resolution Issues]
END

best,
Gerda