Group a query by current month

ktnztigers

New Member
Joined
Jun 10, 2022
Messages
1
Hello

Trying to group data in to month to date which is across multiple weeks. When I put dates between (eg. between 01/06/2022 and 10/06/2022) it brings the data through but on two lines - first line week 1 second line week 2. How do I get the query to group them together please?

1654862245175.png


Currently have it set as
Code:
SELECT TBL_CSBSUMMARY.[Staff Name:TM Name], Sum(TBL_CSBSUMMARY.Checks) AS SumOfChecks, Sum(TBL_CSBSUMMARY.Passes) AS SumOfPasses, Sum([Passes])/Sum([Checks]) AS PRC
FROM TBL_CSBSUMMARY
GROUP BY TBL_CSBSUMMARY.[Staff Name:TM Name], TBL_CSBSUMMARY.[Date of Observation]
HAVING (((TBL_CSBSUMMARY.[Date of Observation]) Between #6/1/2022# And #6/9/2022#));
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Welcome to the Board!

It looks like you are grouping by date:
Rich (BB code):
GROUP BY TBL_CSBSUMMARY.[Staff Name:TM Name], TBL_CSBSUMMARY.[Date of Observation]

You should rather create a calculated field to get the month, and group on that instead.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top