# Calculation Context Issue

**URL:** <https://community.eazybi.com/t/calculation-context-issue/5337>\
**Category:** Questions & Answers\
**Created:** [October 1, 2020, 6:23am UTC](https://community.eazybi.com/t/calculation-context-issue/5337 "2020-10-01T06:23:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jbhere](https://community.eazybi.com/letter_avatar_proxy/v4/letter/j/90ced4/32.png) [@Jbhere](https://community.eazybi.com/u/Jbhere)\
**Post date:** [October 1, 2020, 6:23am UTC](https://community.eazybi.com/t/calculation-context-issue/5337/1 "2020-10-01T06:23:54Z")

</div>

I will be doing defect density, as part of this exercise calculating #of defects/ #of story points for each phases.

Problem is I do not have story points captured in all the defects which was created in Jira. So wherever there is no story points I will be assuming 2 story points be default.

My expected report structure is like this. With Project and Sprint as page filter

| Phase Detected | #of Defects | Story Points | Defect Density% |
| --- | --- | --- | --- |
| All Phases | 17 | 47 | 36% |
| SIT | 10 | 25 | 40% |
| UAT | 7 | 22 | 31.8% |

There is a possibility under SIT phase 5 defects are defined 3 story points each and remaining 5 defects there is no story points defined in Jira. So instead of blank I will be assuming 2 story points for each defects total will be

10 story points (5_2) + already 15 story points defined for 5 stories (5_3) as combined = 25 .

Values which I am getting

| Phase Detected | #of Defects | Story Points | Defect Density% |
| --- | --- | --- | --- |
| All Phases | 17 | 27 | 63% |
| SIT | 10 | 15 | 67% |
| UAT | 7 | 22 | 31.8% |

I can see this in context issue, but I’m not sure how to resolve this.

ASK: How to write formula to satisfy my requirement.

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [October 5, 2020, 3:16pm UTC](https://community.eazybi.com/t/calculation-context-issue/5337/2 "2020-10-05T15:16:16Z")

</div>

Hi,

Here you could try using a custom Javascript code in import options page to manually import 2 Story points for issues without story points.  
Just make sure that you use your Story point custom field ID instead of NNNNN

```
if(issue.fields.customfield_NNNNN == null){
      issue.fields.customfield_NNNNN = 2
    }

```

see more about custom fields here:

> **[Custom JavaScript code - eazyBI for Jira](https://docs.eazybi.com/eazybijira/data-import/advanced-data-import-options/custom-javascript-code)**

Martins / eazyBI support
