Last edited by kestefon; 03-31-2014 at 06:37 PM. Reason: Fixed screenshot/wording.
Are you showing this on a spreadsheet just for ease of posting? Really talking about an Access table?
This could require multiple queries.
SELECT DISTINCT [Date], ProductID FROM tablename;
or
SELECT [Date], ProductID FROM tablename GROUP BY [Date], ProductID;
Then:
SELECT [Date], Count(ProductID) AS CountProd FROM query1 GROUP BY [Date];
SELECT [Date], Sum(Revenue) AS SumRev FROM tablename GROUP BY [Date];
Now do a query that joins those two on the common [Date] field.
The 2 product queries can be nested into one:
SELECT [Date], Count(ProductID) AS CountProd FROM (SELECT [Date], ProductID FROM tablename GROUP BY [Date], ProductID) AS query1 GROUP BY [Date];
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.