Grouping Issues

g0009348

New Member
Joined
Sep 8, 2015
Messages
11
Hi, Can somebody please advise why this query doesn't group the results.

TRANSFORM Count(pt_tbl.ServiceNo) AS CountOfServiceNo
SELECT pt_tbl.Project, IIf([Cat] Is Null,"Awaiting Catagory",[Cat]) AS Catagory
FROM pt_tbl INNER JOIN Late_Cat_tbl ON pt_tbl.ServiceNo = Late_Cat_tbl.Part
WHERE (((pt_tbl.Created) Between (DateAdd("d",-DatePart("w",Now())+3,Now()))-28 And DateAdd("d",-DatePart("w",Now())+3,Now())) AND ((pt_tbl.Late_Release)=True))
GROUP BY pt_tbl.Late_Release, pt_tbl.Project, IIf([Cat] Is Null,"Awaiting Catagory",[Cat]), Late_Cat_tbl.Description
PIVOT "Year" & Format([Created],"yy") & " week" & IIf(DatePart("ww",[Created],4,1)<10,"0" & DatePart("ww",[Created],4,1),DatePart("ww",[Created],4,1));

Instead of a single line for project with a count of late releases, i was hoping it would add them all together. Am I doing something clearly wrong?

Thanks in advance
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hard for me to say just looking at the sql, but maybe this is one of those cases where you need to do this as a totals query first, then transform it with another query.
 
Upvote 0

Forum statistics

Threads
1,221,840
Messages
6,162,311
Members
451,759
Latest member
damav78

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