Calculate the Number of Days Between Two Date Fields in Jira

kempili bhargavi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 27, 2024

 

 

Business Rule: 

Goal:
Automatically calculate the number of days between the "Date of reception" and "Proposed date" fields.

And the numbers of days between the "Proposed Date" and "Opportunity presentation date"


Details:

  1. Fields involved:
    • Date of reception (Date field)
    • Proposed date (Date field)
    • Days Difference (Number or Calculated field) to store the result.
      {{}}
  1. Expected behavior:
    • If both fields have valid dates, the result will be the difference in days.
    • If either field is empty, Days Difference will remain empty.
  1. Automatic update:
    • The calculation will update whenever either date field is changed.

Example:

  • Date of reception: 2024-11-15
  • Proposed date: 2024-11-20
  • Days Difference: 5

Same rule will be applied for Opportunity presentation date.

 

Thank you

3 answers

3 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2024

Hi @kempili bhargavi -- Welcome to the Atlassian Community!

What have you tried thus far to solve this need?

 

If you have a rule that is not working as expected, please post images of the rule and the audit log details, and explain what is not working.  Those will provide context for the community to offer suggestions.

 

If you have not started a rule, I encourage you to try to do so.  The Atlassian Community is a place for people with related interests to learn and collaborate with one another.  It is not a free labor pool to implement requests upon demand.  If you regularly need help with rules, please work with your Jira Site Admin to learn more.

To get you started on creating your rule, please refer to these documentation and example sources:

 

Kind regards,
Bill

0 votes
Utkarsh Agarwal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2024

Hi there! 👋

You can achieve this using Jira Automation by setting up rules to calculate the difference between your date fields. Here’s a step-by-step guide:

1. Set the Trigger

Use the Field Value Changed trigger for the fields involved in the calculation (e.g., "Date of Reception," "Proposed Date," or "Opportunity Presentation Date"). This ensures the rule runs whenever any of these fields are updated.


2. Add a Condition

Add a "Value field" condition to check that both date fields have values before performing the calculation. For example:

  • For the "Days Difference 1" field:
    • Field: "Date of Reception" is not empty.
    • Field: "Proposed Date" is not empty.

Repeat similar conditions for "Days Difference 2."


3. Perform the Calculation

Use the Edit Issue action to calculate and store the difference in your custom number field. You can use this smart value for the calculation:

  • For "Days Difference 1":
    {{Proposed Date.diff(Date of Reception).days}}
  • For "Days Difference 2":
    {{Opportunity Presentation Date.diff(Proposed Date).days}}

If you need to reset the field when one of the dates is cleared, use an IF/ELSE block to set the field to blank when either date is empty.

Kind Regards
Utkarsh

0 votes
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 27, 2024

Hi @kempili bhargavi  Welcome to Atlassian Community!

Use this smartvalue to get difference between date fields

: {{issue.duedate.diff(issue.customfield_10178).days}}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events