# How to create a custom field on import based on Reporter Group and a Label?

**URL:** <https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563>\
**Category:** Questions & Answers\
**Tags:** label, custom-field\
**Created:** [May 8, 2023, 2:39pm UTC](https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563 "2023-05-08T14:39:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristine](https://community.eazybi.com/user_avatar/community.eazybi.com/kristine/32/9579_2.png) [@Kristine](https://community.eazybi.com/u/Kristine)\
**Post date:** [May 8, 2023, 2:39pm UTC](https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563/1 "2023-05-08T14:39:42Z")

</div>

I have been searching the community pages, but have been unable to find an example to help me. I’d appreciate any guidance.

I’d like to create a custom field (Source) during import from Jira that depends on two different fields.

Source = “QA” if

1. Reporter Group (reporter in reporter group: qa)  
OR
2. Label (label in (caught-by-qa))

else Source = “Support” if

1. Reporter Group (reporter is in reporter group: support)

else Source = “Other”

---

<div class="post-metadata">

**Author:** ![Kristine](https://community.eazybi.com/user_avatar/community.eazybi.com/kristine/32/9579_2.png) [@Kristine](https://community.eazybi.com/u/Kristine)\
**Post date:** [May 11, 2023, 6:44pm UTC](https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563/2 "2023-05-11T18:44:06Z")

</div>

I figured out a way to create a measure that depends on two different fields. I created a measure for each field, then aggregated them.

![image](https://community.eazybi.com/uploads/default/original/2X/4/4121eff78767c6853e3ddb7cd354aff15d2931d8.png)

![image](https://community.eazybi.com/uploads/default/original/2X/8/8f788c2b87ce6fc624155f4aa17bc9aca041632a.png)

![image](https://community.eazybi.com/uploads/default/original/2X/8/82114afaa050acd22c0baa569928deaab743a142.png)

My challenge now is how to get this aggregate to just show the unique set of issues since the two groups overlap.

---

<div class="post-metadata">

**Author:** ![Elita.Kalane](https://community.eazybi.com/user_avatar/community.eazybi.com/elita.kalane/32/14957_2.png) [@Elita.Kalane](https://community.eazybi.com/u/Elita.Kalane)\
**Post date:** [May 24, 2023, 12:53pm UTC](https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563/3 "2023-05-24T12:53:20Z")

</div>

Hi @Kristine  
​  
For your use case I recommend creating a new custom field “Source” by writing a JavaScript code. Here is a community post which is very similar to your requirements - [Combine Calculate measure and Calculate member in report columns - #5 by michailgoruynov](https://community.eazybi.com/t/combine-calculate-measure-and-calculate-member-in-report-columns/11267/5).  
​  
​The JavaScript code for your scenario might look as follows, where you replace MMMMM with your custom code ID for the Reporter Group. Once you have updated the [eazyBI advanced settings](https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields/advanced-settings-for-custom-fields) with this code, import the custom field “Source” as a dimension and property.  
​

```auto
​[jira.customfield_source]
name = "Source"
data_type = "string"
dimension = true
javascript_code = '''
// Set Source to QA
if (issue.fields.labels == "caught-by-qa" || issue.fields.customfield_MMMMM && issue.fields.customfield_MMMMM.value === "qa") {
    issue.fields.customfield_source = "QA";}
​else
// Set Group to Support
   if (issue.fields.customfield_MMMMM && issue.fields.customfield_MMMMM.value === "Support") {
    issue.fields.customfield_source = "Support"} 
​ else {issue.fields.customfield_source = "Other"}

'''

```

​  
​Best wishes,  
​Elita from [support@eazybi.com](mailto:support@eazybi.com)  
​  
​

---

<div class="post-metadata">

**Author:** ![Kristine](https://community.eazybi.com/user_avatar/community.eazybi.com/kristine/32/9579_2.png) [@Kristine](https://community.eazybi.com/u/Kristine)\
**Post date:** [May 24, 2023, 3:36pm UTC](https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563/4 "2023-05-24T15:36:33Z")

</div>

@Elita.Kalane , thank you for your response.

I am trying to use the Reporter Group information to set my custom field. Is this possible?

 ![image](https://community.eazybi.com/uploads/default/original/2X/2/2eb5b32ea3193bba8102138670b797ab567e2329.png)

I have found I can create an aggregate measure with Reporter Group, but it does not provide a distinct count of issues.

Can I use Reporter Group in a calculated field dimension?

Thanks.

---

<div class="post-metadata">

**Author:** ![Elita.Kalane](https://community.eazybi.com/user_avatar/community.eazybi.com/elita.kalane/32/14957_2.png) [@Elita.Kalane](https://community.eazybi.com/u/Elita.Kalane)\
**Post date:** [June 27, 2023, 10:55am UTC](https://community.eazybi.com/t/how-to-create-a-custom-field-on-import-based-on-reporter-group-and-a-label/12563/5 "2023-06-27T10:55:26Z")

</div>

Hi @Kristine

My apologies for delayed response. I noticed you had already created another community post for the reporter group. I wanted to follow up with you and check if you managed to get to the results you were looking for?

Best wishes,

Elita from [support@eazybi.com](mailto:support@eazybi.com)
