How do I calculate variance (number) between 2 custom field date fields (baseline date and due date)
Asked by hdave:

I have created 2 custom field date fields (baseline date and due date)

I have also created a third custom numeric field called variance.

How can I get the following result

baseline date - 15 Apr 2021

due date - 30 Apr 2021

variance in days is **-15**

I have been trying automation but no luck. appreciate if you can provide solution thanks


Answers:
author: Rohan Swami
body: [@hdave](/t5/user/viewprofilepage/user-id/4318661) I'm a Product Manager on the Jira Software team, I'd love to get a deeper understanding of what you're looking to achieve with these calculations in Jira Software. Could you drop me a message at r swami @ atlassian . com and we can arrange a call to discuss?

comments: author: hdave
body: doing now... thanks Rohan


author: Curt Holley
body: Using Automation for Jira you should be able to populate your variance field by putting something like this in it.

As in, use the edit issue action, select the Variance field and add:

{{(issue.baseline date).diff(issue.due date).days.abs}}

Then hit "enter" on your keyboard (to make it stick)

Have a look at this page for further assistance [Smart values - date and time functions \| Jira Software Cloud \| Atlassian Support](https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/)


author: Joseph Chung Yin
body: [@hdave](/t5/user/viewprofilepage/user-id/4318661) -

Can you confirm if this ask is related to Advanced Roadmap? Based on your ask, I am assuming you are referring to Jira custom fields setup and it is really not related to Advanced Roadmap. If it is for Jira custom fields setup, then you can create "Scripted Field" (essentially a calculated field) to achieve what you are asking.

The create "Scripted field" in Jira, you will need Script Runner for Jira add-on (An excellent add-on to have in your system from my years of Jira admin/functional leads experiences) [https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira?hosting=cloud\&tab=overview](https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira?hosting=cloud&tab=overview).

In our environments, we have many scripted fields that provide variance dynamically and we expose them into our Jira/JSM projects issues.

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Infrastructure Applications Team

Viasat Inc.

comments: author: hdave
body: thanks Joseph What I need is a variance in date fields .. since there is no function for data 1-date 2 , i had to use a third field. I would ideally like to manage it out of box - with no extra plugins but if there is no way out then I will have to apply the plugin thanks


author: Joseph Chung Yin
body: [@hdave](/t5/user/viewprofilepage/user-id/4318661) -

Can you confirm what application are you referring? Jira Software or JSM? In addition, what is your env type? (CLOUD or Data Center)

Best, Joseph


author: Curt Holley
body: Good questions [@Joseph Chung Yin](/t5/user/viewprofilepage/user-id/396739) I always assume people are on Cloud ?


author: Joseph Chung Yin
body: [@Curt Holley](/t5/user/viewprofilepage/user-id/3527535) -

If the user's env is JSM cloud (non-premier account), then I don't believe Automation for Jira is a auto add-ons. Anything associated with DC or server env, Automation for Jira is a separate paid add-on.

Best, Joseph


author: Curt Holley
body: I think It is available of Cloud standard [@Joseph Chung Yin](/t5/user/viewprofilepage/user-id/396739) , but has restrictions on Multi Project and Global rule executions. Agreed plug-in for non-cloud ?

Definitely be good to know exactly what setup [@hdave](/t5/user/viewprofilepage/user-id/4318661) is using.


Tags: advanced-roadmaps

date