I have two tables related to tickets, DimTickets and want to calculate the time it takes between the CreatedDateTime and when the status was first changed to Done/Released. The DimTickets table is structured like so:
IssueKey | IssueType | Priority | Project | Status | CreatedDateTime |
---|---|---|---|---|---|
TEAM1-100 | Story | High | Team 1 | Approved for Release | 2020-04-02 16:09:45 |
TEAM1-101 | Task | Medium | Team 1 | Done | 2020-04-03 15:38:25 |
TEAM1-102 | Sub-task | Low | Team 1 | Done | 2020-04-08 09:03:43 |
TEAM1-103 | Bug | High | Team 1 | In Progress | 2020-04-13 12:18:56 |
TEAM1-104 | Task | Medium | Team 1 | Done | 2020-04-16 11:40:08 |
TEAM2-100 | Task | Medium | Team 2 | Done | 2020-04-17 09:06:17 |
TEAM2-101 | Story | Medium | Team 2 | Released | 2020-04-17 15:55:45 |
TEAM2-102 | Task | Low | Team 2 | Done | 2020-04-20 10:12:41 |
TEAM1-105 | Task | High | Team 1 | In Progress | 2020-04-20 15:24:56 |
and a DimTicketChangelog that's structured like this:
ChangeLogID | IssueKey | FromStatus | ToStatus | ChangeLogDateTime |
---|---|---|---|---|
1 | TEAM1-100 | 1 | 2 | 2019-06-14 15:56:03 |
2 | TEAM1-100 | 2 | 3 | 2019-06-15 12:58:29 |
3 | TEAM2-102 | 2 | 4 | 2019-06-16 17:58:48 |
4 | TEAM1-100 | 3 | 5 | 2019-06-16 20:01:43 |
5 | TEAM1-104 | 1 | 3 | 2019-06-18 10:02:39 |
6 | TEAM1-105 | 4 | 5 | 2019-06-21 18:03:19 |
7 | TEAM1-104 | 3 | 5 | 2019-06-24 22:05:28 |
8 | TEAM2-102 | 4 | 6 | 2019-07-02 08:06:50 |
9 | TEAM2-103 | 1 | 4 | 2019-07-04 11:06:50 |
Is there a way for me to join to DimTicketChangelog the first time a ticket is changed from a status < 5 to status 5/6 so that I can create a field that is essentially ChangeLogDateTime - CreatedDateTime to get the amount of time it took between creation of the ticket, to when it had its status changed to a resolved one?