Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
darren_dixon
Contributor III
Contributor III

count by date

Hi,

I am looking to count the number of orders which have been completed today.

I've tried the following code:

sum( {$<ClosedDate = {$(Date-Today)}>} mrID)

Variable:

Date-Today = Today()

Data

mrID     ClosedDate

1          18/09/2013

2          19/09/2013

3          19/09/2013

4          19/09/2013

Thanks,
Darren

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try:

sum( {$<ClosedDate = {'$(=Date(Today(),'DD/MM/YYYY'))'}>} mrID)

View solution in original post

7 Replies
tresesco
MVP
MVP

Try:

sum( {$<ClosedDate = {'$(=Date(Today(),'DD/MM/YYYY'))'}>} mrID)

darren_dixon
Contributor III
Contributor III
Author

Unfortunately it returns a value of 0

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi, In script create the flag based on, if(fabs(today()) = fabs(ClosedDate),1,0) as FLAG_NO_OF_ORDERS_CLOSED In Expression, sum(FRLAG_NO_OF_ORDERS_CLOSED) Regards Sathish

tresesco
MVP
MVP

PFA. It works fine. The most likely issue is date format. You might want to share your sample app.

Anonymous
Not applicable

Hi,

If your mrID is an ID, then you have to count it and not to sum it.

Otherwise if it is the number of orders then you have to sum it.

The formula should be:

If mrID is an ID:

count({$<ClosedDate = {'$(=today())'}>} mrID)

If mrID is the number of orders:

sum({$<ClosedDate = {'$(=today())'}>} mrID)

darren_dixon
Contributor III
Contributor III
Author

Hi Tresesco,

Thanks for your sample data. The date format was the issue and was resolved by date(floor(Date)).

Thanks again for your help

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi, Don't use count function in the expression. Because it takes lot of memory. So better create the flag in the script level. And in expression use sum(Flag). Regards Sathish