So I currently am using Jira with Domo to create Dashboards for our team.
Currently I am wanting to display the time each ticket spends in each status per ticket.
For example I have a table like this.
|date |From | To |Ticket ID
|01/01/21 |Open |In progress |1
|01/03/21 |In progress|In review |1
|01/10/21 |In Review |Done |1
|01/15/21 |Done |Resolved |1
|01/01/21 |Open |In progress |2
|01/03/21 |In progress|In review |2
|01/10/21 |In Review |Done |2
|01/15/21 |Done |Resolved |2
With this I would like to be able to see how long each ticket spends in each status.
A single ticket can be go back to a status multiple times before it is done.
I really have no idea where to start with a mysql query to start with this. Is there a simple query to do this?
something along the lines of : Sample data
query:
The first query part 'partitioned' uses a windowing function to group the data for each ticket.
The second part uses a self join link each state for a ticket to the next state for the same ticket (using the row number from the first step)
the third part calculates the number of days in each state (if a ticket transitions to the same state multiple times it will have multiple rows for that stat)
finally calculate the totals in each state for the ticket
https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html