Results 1 to 6 of 6
  1. #1
    Ptla is offline Novice
    Windows 11 Access 2013 64bit
    Join Date
    Nov 2023
    Posts
    2

    Counting the number of distinct dates in a report column

    I am the Treasurer for a small church. I have been asked to create a database to track member attendance at different events such as (Sunday Worship, Bible Class, Communion, Etc.). I am using Access 2013. I have created 3 tables, they are Member, Event, and Events Tracker. Events Tracker has 3 fields: Member, Event, and Event Date. The Member and Event fields use drop down boxes from their perspective tables. I have created a report that is grouped on the Event Date. When I filter a specific event how can I have the Event Date column only a number that gives the total of specific dates rather than a count of all the records? Then how can I take the total of the records and divide by the number of distinct dates?



    11/5/2023
    11/10/2023
    11/5/2023
    11/15/2023
    11/20/2023
    11/5/2023

    In this example there are 6 records with 4 distinct dates. The average is 1.5 (6/4 = 1.5).

    Thank you for your help.
    Ptla

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Your table structure is Many-to-Many. Have a look at this link to see a comprehensive DB solution for such requirements.
    It includes many reports for tracking the member/event assignments.

    Many-To-Many, two ways to update Junction table, includes Not In List handling (accessforums.net)

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Dave, nice demo of forms but don't see how this relates to OP question: "gives the total of specific dates rather than a count of all the records".

    One way is to use DCount() domain aggregate function in report header or footer textbox: =DCount("*", "Event", "filter criteria here as appropriate")

    If you filter for a specific event, why would there be multiple dates?

    Average what? Exactly what does this ratio mean to you?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Ptla is offline Novice
    Windows 11 Access 2013 64bit
    Join Date
    Nov 2023
    Posts
    2
    For example the need for an average is there are multiple dates in a given time period lets say 1 year. Members meet a total of 500 times to one event held at 15 different dates. That gives me an average of 33.3 attending each day (500 / 15 = 33.3).

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    You need two queries, the first to select distinct queries , the second to do your count of dates in this query

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Have a query that displays distinct dates for required period.
    Use that value from a DCount() of that query to do your math.
    You will already have a count of the records in the report.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-08-2017, 02:01 AM
  2. Replies: 0
    Last Post: 06-13-2016, 06:15 PM
  3. Replies: 2
    Last Post: 12-05-2011, 04:53 AM
  4. Replies: 4
    Last Post: 08-27-2009, 01:21 AM
  5. Counting distinct id's
    By jqljql in forum Access
    Replies: 1
    Last Post: 09-01-2006, 07:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums