4 followers Follow

How to count how many referenced items by specific status & by specific date period


I am looking to install a code to find how many closed deals in a given period of time.

I need to filter the calculation by Status & by date period to show which items are "Closed Deals" and are in a given weeks period, i.e.


Any suggestions are welcomed. Thank you

Aaron Mullins

Please sign in to leave a comment.

1 comment

Hi Aaron,

var periodStart = moment(@date field1);
var periodEnd = moment(@date field2);
var dates = @All of date field from related app;
var status = @All of status field from related app;
sum = 0;
for(var i = 0; i < dates.length; i++){
    if((moment(dates[i] >= periodStart && moment(dates[i] <= periodEnd) && status[i] == "Closed"){
    sum += 1;

Cause I don't know how you define periodStart and periodEnd (is it a date, a calender week number; do the values come from fields in your app or do you want to hard code them....?) I've taken 2 date fields for my example.


Rainer Grabowski 0 votes
Comment actions Permalink