5 Replies Latest reply: Aug 16, 2012 5:39 AM by Kiran Rokkam

# Count within 7 days or N number of days.

Hi,

I have a scanario where I need to find the number of days. I have two days between I need to find. What is the best approach to find the day. Right now I am using interval ( one date field - another date field) <7, then count so particular column. Need some more optimized query to perform this operation.

Best Regards,

SKumar

• ###### Re: Count within 7 days or N number of days.

Interval will compute the duration in hrs, min and sec. For just days, you can directly use date1-date2.

Kiran.

• ###### Re: Count within 7 days or N number of days.

Hi Kiran, I am tried to do the same thing in my expression but it does not return any value. I have two date field column, where I did (Date_Received-Date_Issued) but it doesn't work. Do i need to add any additional function to return the number of days? Best, Skumar

• ###### Re: Count within 7 days or N number of days.

Kumar,

For the dimensions in the table if only one value of Recieved date and issued date exist then the expression will work. To check if multiple values are there use AVG(Date_Received-Date_Issued).

Regards,

Kiran.

• ###### Re: Count within 7 days or N number of days.

Hope it helps!

```age( timestamp, date_of_birth )
Returns the age at the time of timestamp (in completed years) of a
someone born on date_of_birth.
Example:
age('2007-01-25', '2005-10-29') returns 1
age('2007-10-29', '2005-10-29') returns 2
```
• ###### Re: Count within 7 days or N number of days.

Hi, Age function will return the year of your age. So it doesn't help in my case. If you know any function which returns the number of days in count, that please share with me. It would be great if you have any script or expression for bucket analysis, you can attach the sample, that would be great help. Thanks, SKumar