It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Sum the timeSpent in JQL over the period of time

Michal Dio Oct 31, 2017


I'm strugling in summing up the timespent over the defined time period.


This query

worklogAuthor = User  AND  issueFunction in aggregateExpression("Total tracked", "timespent.sum()") AND worklogDate >=  startOfMonth() 


returns timespent on the issues over the whole existence of the issue. I cannot find the way how to get the sum only over defined time period. Can anybody help, with formulating such query?


Thanks a lot!

2 answers

1 vote
Andrew Heinzer Atlassian Team Nov 01, 2017

Hi Michal,

JQL is limited in that it is only designed to return a list of Jira issues.  I understand that you are looking for a specific segment of data in those issues, but JQL is not granular enough to provide only this.  It is designed to return the issues in Jira that match your query and with it all the values in that issue.   In this case the Scriptrunner provided JQL function, aggregateExpression is still not going to change the values pulled in by the rest of the JQL query according to the documentation of this function.

Personally I think you would have better chance of success trying to get this data from the SQL database directly instead of JQL.   But this would probably require that you then manipulate the SQL results in something like Excel to sum only these values within a certain date range.

I was able to whip up a SQL query that can gather these specific worklogs based on the date they were created rather than all the worklogs for an issue that JQL is gathering:

SELECT wl.*, P.PKey || '-' || ji.IssueNum as IssueKey
FROM worklog wl
join jiraissue ji on = wl.issueid
join Project P on ji.Project = P.Id
where wl.created > '2017-10-01';

This returns the entire worklog table, but it also adds in the jira issue key, and then filters only entries created after the date I of Oct 1st.  The timeworked field in this table is the time worked on the issue in seconds.

I understand if this isn't exactly what you are looking for, but I can't see a way to do this within JQL currently.


Stefan Radulian Mar 30, 2018

Hi, i have the same need and I am using Quick Timesheet Plugin.

I am defining a date range and use a specific filter for the type of issues i am interested in (e.g. bugs).

Can I expect the output to be accurate, i.e. time spent on certain issues in a given period of time?

1 vote
Gildas Amegninou Sep 14, 2018

I'm agree with @Andrew Heinzer, but I wrote another solution here without SQL :


I guess these two topics are close

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Software

Demo Den Ep. 5: Meet Jira Mobile

See how to use Jira on the go! Demo Den Episode 5 is here: meet Jira Mobile with  Jira  Product Manager Rayen Magpantay.  Demo Den is in our monthly series where a Jira PM demonstrates...

441 views 1 10
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you