Calculate elapsed date
Asked by Shathya Bhama V R:

I am creating a confluence table to track the open issues and want to calculate the aging in days. Need to calculate the Aging by finding the elapsed date between current date and the Open date if there is no date in Closed date column. If there is a date in Closed date it should find the number of days between Open and Closed date and fill in the aging column.


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Shathya Bhama V R](/t5/user/viewprofilepage/user-id/4131249) ,

Sorry that we've missed your question about our [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) macro.

Glad that you've find the solution yourself: here is [our answer](https://community.atlassian.com/t5/Confluence-questions/Table-Transformer-Macro-If-else-condition/qaq-p/1511033) for your second question about the WHEN condition in the Table Transformer SQL query.

**And for the customers that may come across this question:** the task was resolved with the help of the [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview) app. Just wrap your Jira Issues macro in the Table Transformer macro body and use the following custom SQL query to calculate aging in days:

SELECT \*,

CASE WHEN T1.'Status' LIKE "Closed"

THEN ROUND(DATEDIFF(day,'Open Date','Closed Date'))+ " day(s)"

ELSE

ROUND(DATEDIFF(day,'Open Date',CURRENT_TIMESTAMP))+ " day(s)"

END

as 'Aging' from T1

comments: author: Shathya Bhama V R
body: Thank you very much!


author: Mehmet A _Bloompeak_
body: Hi [@Shathya Bhama V R](/t5/user/viewprofilepage/user-id/4131249)

The feature you are looking for is not a built-in functionality in Jira and Confluence.

Our team at Bloompeak developed [Status Time app](https://marketplace.atlassian.com/apps/1221826/status-time?hosting=cloud&tab=overview) for this exact need. Additionaly, once you enter your working calendar into the app, it takes your working schedule into account too. That is, "In Progress" time of an issue opened on Friday at 5 PM and closed on Monday at 9 AM, will be a few hours rather than 3 days. It has various other reports like assignee time, status entry dates, average/sum reports(eg. average in progress time per project).

Here is the [online demo link](https://status-time.bloompeak.io/demo), you can see it in action and try. Hope it helps.


author: Mariana_Pryshliak_Saasjet
body: Hello [@Shathya Bhama V R](/t5/user/viewprofilepage/user-id/4131249)

Can you precise whether you need the add-on for confluence or cloud?

If you need Cloud one, you can try [Time between Statuses.](https://marketplace.atlassian.com/apps/1221462/time-between-statuses?hosting=cloud&utm_source=Atlassian_Community&utm_medium=Comments&utm_campaign=TBS_cloud)

This add-on calculates how long it takes an issue to move from one status to another.

I hope it helps.

Best regards, Mariana

![tbs.png](https://community.atlassian.com/t5/image/serverpage/image-id/115265iF837B1CF6B8694AE/image-size/large?v=v2&px=999 "tbs.png")


author: Emre Toptanc? _OBSS_
body: Hello [@Shathya Bhama V R](/t5/user/viewprofilepage/user-id/4131249) ,

Unfortunately Jira (or Confluence) does not provide this functionality. For Jira Cloud, you would need to get the data from Jira REST API and do the calculation yourself.

For a ready built solution that offers great fexibility and details, our team at OBSS built **Time in Status** app for this exact need. It is available for Jira Server, Cloud and Data Center.

Time in Status allows you to see how much time each issue spent on each **status** or assigned to each **assignee** as well as **entry/exit dates** for all statuses. You can calculate **averages** and **sums** of those durations grouped by issue fields you select. (For example see the average InProgress time per project and per issuetype). You can also combine statuses into consolidated columns to see metrics like **Ticket Age,****Cycle Time** or **Lead Time**.

The screenshot below shows the Lead Time as a single column and you can do the same for any combination of columns.

![tisCloud_StatusSelection_Consolidated_output.png](https://community.atlassian.com/t5/image/serverpage/image-id/114791iDC36935C4531F066/image-dimensions/296x180?v=v2 "tisCloud_StatusSelection_Consolidated_output.png")

The app calculates its reports using already existing Jira issue histories so when you install the app, you don't need to add anything to your issue workflows and you can get reports on your past issues as well.

The app has C*ustom calendar support* which means you can get your reports based on a 24/7 calendar or your custom business calendar. (This one is important because a 24/7 calendar in most cases shows misleading data. For example an issue created at 16:00 on Friday and was resolved at 09:00 on next Monday seems to stay open for 2,5 days but in terms of business hours, it is only a few hours. You can see this using Time in Status by OBSS.)

Using Time in Status you can:

* See how much time each issue spent on each status, assignee, user group and also see dates of status transitions.
* Calculate averages and sums of those durations grouped by issue fields you select. (For example see average InProgress time per project and per issuetype.)
* Export your data as XLS, XLSX or CSV.
* Access data via REST API.
* Visualize data with various chart types.
* Get reports via Dashboard Gadgets.

<https://marketplace.atlassian.com/1211756>

EmreT


Tags: cloud

confluence-cloud