How long a ticket sits with an individual team for

Dear team, can you please advise on how can we get the number of hours spent on a ticket by each team.
I was trying to create a table where I am using as a measure Hours spent :

but the table above is showing me only the hours spent on a ticket by the last Team, not by every historical Team on the ticket.

Hi @gamthe2nd,

Measure “Hours spent” is retrieved from the worklogs and you might want to use this measure in combination with dimensions “Logged by” (Jira Core measures and dimensions) or Tempo specific dimensions “Logged by Team” (Tempo).

If you have the Tempo app, add dimension “Logged by Team” to group issues by the user team who reported hours in Jira.

Check out this community post on a similar use case:

If you do not have Tempo, an alternative is to use “Logged by” dimension and group users by teams. The best approach would be to import the Team name as property for each Logged by user and then create a custom hierarchy (Custom hierarchies).
This community post describes step by step how to do this for the “Assignee” dimension. However, you can do the same thing and import properties for the Logged by dimension:

Best,
Zane / support@eazyBI.com

Hello Zane,

Thank you for your reply. Is there any chance to create a measure to calculate the total time spent by the Custom Field called Team for a specific Issue?
I tried to use the following but it didn’t work :
[jira.customfield_time_for_team]
name = “Time for Team”
data_type = “decimal”
measure = true
multiple_dimensions = [“Time”,“Team”]
javascript_code = ‘’’
var Teamhistory = new Array();
var datefrom = issue.fields.created;
var Team = null;
resolution = false;

issue.changelog.histories.forEach(function(history){
history.items.forEach(function(historyItem){
if (historyItem.field == “Team” && ! resolution) {
Team = historyItem.from;
dateto = history.created;
if(Team){
duration = workinghours ( datefrom, dateto );
Teamhistory.push(dateto.toString().substr(0,10) + “,” + Team + “,” + duration);
}
datefrom = dateto;
Team = historyItem.to;
}
if (historyItem.field == “resolution”) {
if (historyItem.to) resolution = true;
else resolution = false;
}
});
});

if (issue.fields.resolutiondate && (issue.fields.Team || Team)) {
if (!Team) Team = issue.fields.Team.name;
duration = workinghours ( datefrom, issue.fields.resolutiondate);
Teamhistory.push(issue.fields.resolutiondate.toString().substr(0,10) + “,” + Team + “,” + duration);
}