I need to create a formula that calculates the resolution working days starting counting from status “In progress”, taking into account that it can go through the “In progress” state several times, so the calculation must start counting from last change to “In progress”.
Is it possible to do the same but starting to calculate from the last assignment of a ticket to a user ?
Check EazyBI Demo account (e.g. Issue days in selected status - Issues - Jira Demo - eazyBI), at least you may find something to start from.
Report definitions can be exported and replicated in your account, thus all the calculated members or measures will be available at your end.
@VasileS is right about using DateDiffdays() function with transition dates (and now).
You can use a similar approach also for the transition in the Assignee field (as well as in other fields where you import change history). For that, use the hidden change history dimension “Transition Field” with the needed field (Assignee) and measure “Transition to last timestamp” to get the timestamp of the last assignee change date. Read more about them in doc: Import issue change history
The calculation would be the following:
DateDiffDays(
TimestampToDate(
([Measures].[Transition to last timestamp],
[Transition Field].[Assignee],
[Time].CurrentHierarchy.DefaultMember)
),
Now()
)
Remember to set the needed date formatting (decimal, I suppose). If you need to display values as a duration (like 3d 23h 05m), use DateDiffMinutes() function instead, as you need the result in minutes for converting it to duration.
you may use the same approach, only substitute Now() for the issue resolution date. When you use DateDiffDays function, there is need for any two dates, so use whichever is needed for them.
DateDiffDays(
TimestampToDate(
([Measures].[Transition to last timestamp],
[Transition Field].[Assignee],
[Time].CurrentHierarchy.DefaultMember)
),
[Measures].[Issue resolution date]
)
It works in a typical use case assignee is not changed after the issue is resolved, as it takes the very last transition to assignee, independently of resolution date.
Now I need to show the average time in days for each user without showing the data for each ticket (issue) and only count resolved tickets. If I remove the Issue field from the rows, the result is empty and I only want the average time for each user to appear.
Can you count the days without taking into account weekends or holidays?
The problem is when a ticket is resolved at a given time and after this is changed the Assignee, in this case the value is negative and should not count in AVG.
Great, your average calculation formula seems to be correct.
Now about negative values: if you want to skip those issues with transition after the resolution date, then add a condition to check both dates and exclude such issues:
Avg(
Filter(
Descendants([Issue].CurrentMember, [Issue].[Issue]),
-- for resolved issues only
not isEmpty([Measures].[Issue resolution date])
),
case WHEN
DateCompare(
TimestampToDate(
([Measures].[Transition to last timestamp],
[Transition Field].[Assignee],
[Time].CurrentHierarchy.DefaultMember)),
[Measures].[Issue resolution date])<=0
then
DateDiffDays(
TimestampToDate(
([Measures].[Transition to last timestamp],
[Transition Field].[Assignee],
[Time].CurrentHierarchy.DefaultMember)
),
[Measures].[Issue resolution date]
)
END
)
If you always want to find and use the last assignee transition before resolution date, then it would get too complicated for the calculation. Then the best approach would be inventing JavaScript calculated custom field that, during data import, goes through each issue changelog and retrieve days for the last assignee; it would be something similar to the already mentioned Days for assignee scripted custom field.
In the formula, the Time dimension is used in All times level to avoid limiting the time period when the assignee transitions have happened, therefore Time selection is not applied to the formula.
To filter issues by the issue resolution date, you may include the filter in the formula together with the issue property “Issue resolution date” - instead of checking its existence, check if it is within the particular time period. In such a way, you apply time only on the issue resolution date.
Avg(
Filter(
Descendants([Issue].CurrentMember, [Issue].[Issue]),
-- for resolved issues within selected time period in rows
DateInPeriod(
[Measures].[Issue resolution date],
[Time].CurrentHierarchyMember)
),
case WHEN
DateCompare(
TimestampToDate(
([Measures].[Transition to last timestamp],
[Transition Field].[Assignee],
[Time].CurrentHierarchy.DefaultMember)),
[Measures].[Issue resolution date])<=0
then
DateDiffDays(
TimestampToDate(
([Measures].[Transition to last timestamp],
[Transition Field].[Assignee],
[Time].CurrentHierarchy.DefaultMember)
),
[Measures].[Issue resolution date]
)
END
)