Ticket open duration in days
Asked by Krzysztof Achinger:

Hello EAP Team,

I am trying to show a table with tickets' open duration in days. The column should show days between Issue Created At date and now. Is it possible, is there an easier way to achieve that?

I was looking to add a column that stores now date but that did not seem to be possible.


Answers:
author: Tracy Chow
body: You can add a formula column with a custom formula using the SQLite datediff function and the relative date variable {TODAY}.

![Screen Shot 2022-03-04 at 12.29.39 PM.png](/t5/image/serverpage/image-id/186521i35D8BC126BA774DD/image-size/large?v=v2&px=999 "Screen Shot 2022-03-04 at 12.29.39 PM.png")

comments: author: Krzysztof Achinger
body: It did the trick. I was actually playing with {TODAY} after reading the documentation but I did not know I need to use Custom formula for it to work. Thank you.


author: Kamal Rajpal
body: Is there any way to get this calculation done in JQL, which I am using to create filter in JIRA

comments: author: Cat Africa
body: Hi, [@Kamal Rajpal](/t5/user/viewprofilepage/user-id/5016115)! It may be better to ask this question in Jira's Community group: <https://community.atlassian.com/t5/Jira/ct-p/jira>


author: Cat Africa
body: Hey, Krzysztof! You can use the `{TODAY}` [relative date variable](https://analytics-docs.atlassian.net/wiki/spaces/ANALYTICS/pages/11173917/Relative+date+variables) to get today's date.

For what you're trying to do, you can do the following (assuming you've made your initial query with the "Created At" column):

1. Add a **Formula column** step.

2. Select **Custom** as the formula type.

3. Enter `{TODAY}` as the formula.

4. Select **Save**. You should now have a new column where all the rows are today's date.

5. Add another **Formula column** step.

6. Select **Date difference** as the formula type.

7. For the parameters, first select the **Created At** column, then select the new today column you created, then select **Day** as the time unit.

8. Select **Save**. This should give you the date difference you're looking for.

Hope that helps a bit!

comments: author: Krzysztof Achinger
body: It did help, thank you.


author: Adam Nichols (DISH)
body: We have run into the same issue and had to create a custom script

comments: author: Krzysztof Achinger
body: No way! How do you create custom script and where do you store the data if that is not too much to ask? Any additional pointers will help.


author: Adam Nichols (DISH)
body: Here is the script we used in Automation for Jira

{{now.diff(issue.created).abs.days}}


author: Krzysztof Achinger
body: Right, all my previous data issues I was also resolving with Automation for Jira. I was hoping that I will not have to do it in Atlassian Analytics.

[@Matt David](/t5/user/viewprofilepage/user-id/4301097) [@Cat Africa](/t5/user/viewprofilepage/user-id/4430495) hope you are reading :)


author: Adam Nichols (DISH)
body: Actually this is for our Jira Software, not Analytics, so that actually may be a different solution, I will defer to EAP


author: Vinci Louise Morales
body: Is there a way to change the format of {TODAY} into Date and Time?


author: Rohit Kavuluru
body: In Atlassian Analytics, you can't change the {TODAY} format as it's a pre-defined system variable representing the current date. There isn't a built-in feature to change its format.

You can, however, add an additional"Created At" column below to display the date and time separately in your results table. You can also manually query for the date or time and display them as separate columns using our SQL editor. Hopefully, this addresses your question!

![Screenshot 2023-08-10 at 1.38.29 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/274511i7D5089D9FA892097/image-size/large?v=v2&px=999 "Screenshot 2023-08-10 at 1.38.29 PM.png")


Tags: date