Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct Count and Dates

Status
Not open for further replies.

mmemon

Programmer
Nov 21, 2002
46
US
Hello

I need to calculate the count of distinct records that have a value in a date field that falls within a certain range.

ID Territory Date
1 95 11/2/2002
2 95 12/5/2001
3 60 9/15/2001
4 60 9/30/2001

So, I need to ask, How many distinct records have a date between 9/1/2001 and 9/31/2001. Here I would show

Territory 60 has 2 records.
Territory 95 has 0 records.

I have the distinct count function on the ID fields but I need to take it a step further and calculate how many distinct records are within a certain date range.
 
If you are trying to report on this, then I would just group by ID, then Territory.
 
Yes, I do need to report on this but I ultimately have to show the below

Sept Oct Nov Dec Jan Feb etc....
Territory 95 1 1
Territory 60 2
Territory 55 3


SO, I was thinking I have to write a formula for each month and count the number of records that fall under each month.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top