Run this example
Create a table called Tbl_Customers
Create 2 fields
CustomerID (autonumber)
CustomerName (text)
Put in two customer names
Create a table called Tbl_Bills
create 4 fields
BillID (autonumber)
BillAmt (currency)
BillDate (date/time)
CustomerID (number)
Add some sample data in the billamt and billdate field (span months and dollar amounts) For the customerID always put in the value of your first customer (just to see what this code do not enter anything for customer 2)
Run this query
Code:
SELECT Tbl_Customers.CustomerID, Tbl_Customers.CustomerName, Sum(Tbl_Bills.BillAmt) AS [Total Bills], IIf(IsNull([billdate]),Null,DatePart("yyyy",[billdate]) & ", " & Mid(Format([billdate],"medium date"),4,3)) AS MonthLabel
FROM Tbl_Customers LEFT JOIN Tbl_Bills ON Tbl_Customers.CustomerID = Tbl_Bills.CustomerID
GROUP BY Tbl_Customers.CustomerID, Tbl_Customers.CustomerName, IIf(IsNull([billdate]),Null,DatePart("yyyy",[billdate]) & ", " & Mid(Format([billdate],"medium date"),4,3));
It will total everything by month for your customer and leave anything blank for customers who have no activity or data.
From this point you can apply filters however you want.
The key is that you're building a GROUPING query (the GROUP BY clause of the SQL statement) if you look at the design view of the query you'll notice there's a new line called TOTAL. Anything that you'll notice everything says GROUP BY except the BILLAMT field.
Anything that says GROUP BY you will get a separate line for each individual value so if your first customer has services in three different months you will get three different lines because the TOTALS line for the MONTHLABEL field says GROUP BY.