# How to use the old values measure?

**URL:** <https://community.eazybi.com/t/how-to-use-the-old-values-measure/9654>\
**Category:** Questions & Answers\
**Tags:** jira, calculatedmembers\
**Created:** [May 25, 2022, 9:10am UTC](https://community.eazybi.com/t/how-to-use-the-old-values-measure/9654 "2022-05-25T09:10:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![XavierH](https://community.eazybi.com/letter_avatar_proxy/v4/letter/x/ebca7d/32.png) [@XavierH](https://community.eazybi.com/u/XavierH)\
**Post date:** [May 25, 2022, 9:10am UTC](https://community.eazybi.com/t/how-to-use-the-old-values-measure/9654/1 "2022-05-25T09:10:48Z")

</div>

Like talk in this topic : [Target Start Old Values - #2 by zane.baranovska](https://community.eazybi.com/t/target-start-old-values/9359/2)  
and documented in here : [Jira custom fields](https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields#Jiracustomfields-Customdatefieldoldvalues)

I created a measure " **Issue Custom field old values**" , i want to make a graph where axe X is Time.  
And Y i a measure that count 1 everytime i got a Time matching the date in the measure " **Issue Target start old values**".

i can show the old value by chosing issue dimension in row and then chosing the measures in column.

this is the result :

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

i wonder if what the measure return is an array of Date or just a string

My final will is to have Time dimension in row and create a measure base on " **Issue Target start old values**" . Like my description below.

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

---

<div class="post-metadata">

**Author:** ![gerda.grantina](https://community.eazybi.com/user_avatar/community.eazybi.com/gerda.grantina/32/1994_2.png) [@gerda.grantina](https://community.eazybi.com/u/gerda.grantina)\
**Post date:** [June 6, 2022, 7:55am UTC](https://community.eazybi.com/t/how-to-use-the-old-values-measure/9654/2 "2022-06-06T07:55:52Z")

</div>

Hi @XavierH  
​The default issue property shows just what has been the previous dates for the particular date field.  
​But if you would like to count how many issues have had a due date on a particular day, you can use Javascript in [advanced settings](https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields/advanced-settings-for-custom-fields) to define (and then select for [import](https://docs.eazybi.com/eazybi/data-import/data-from-jira#DatafromJira-JiraCustomFields)) a new pre-calculated field “Date picker history”. Then, using the “Time” dimension, the measure would return 1 for all the previous date picker values.  
​Below is the script I used in my example with the custom date picker field “Program end”:

```auto
[jira.customfield_enddatehistory]
name = "Program End history" 
data_type = "integer"
measure = true
multiple_dates = true
javascript_code = '''
var enddatehistory = new Array();
if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
  var histories = issue.changelog.histories;
  for (var i = 0; i < histories.length; i++) {
    var history = histories[i];
    if (history.items && history.items.length > 0) {
      for (var n = 0; n < history.items.length; n++) {
      var item = history.items[n];
      if (item.field == 'Program End') { 
        //value date + counter
        enddatehistory.push(item.to+ "," + 1);
        }
      }
    }
  }
};
if(enddatehistory)
{issue.fields.customfield_enddatehistory = enddatehistory.join("\n");}
'''

```

​  
​In the report:

 ![History_report](https://community.eazybi.com/uploads/default/original/2X/e/e89eb8489e4531684e758752b07d39e4fa42e775.jpeg)

best,  
Gerda // [support@eazyBI.com](mailto:support@eazyBI.com)
