Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Question Unanswered: Creating a query that groups data by week

    I am trying to write a query that outputs information and gives me weekly totals. There are calculations involved in the data that will have to use the weekly sum to output calculated fields. I can do this in a report using the wizard (it will calculate the sums and then I add new text boxes that use the calculated sums to calculate averages and so forth), but can't seem to write a query that does the same thing. I don't know how to write in VB, so I need to know if this is possible using the existing query engine of MS Access.


  2. #2
    Join Date
    Nov 2003
    Here is the basic syntax for you to use in your query (SQL View). You will nedd to change it to match you variable names.

    SELECT DatePart("ww",[Table1]![Date]) AS WeekNum,
    Sum([Table1]![Variable1]*[Table1]![variable2]) AS Total
    FROM Table1
    GROUP BY DatePart("ww",[Table1]![Date]);


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts