Lots of questions from me lately. Other users have come up with evolving needs.
I have a field Date_Closed and in its criteria a put a range of dates. Its is really putting todays date and back into the number of days historical data: Between Date()-7 And Now().
Since I have multiple queries using the same field (Date_Closed) I would like to have a form maybe where I can choose the number of days and it affects them automatically.
I am doing this to cut my queries by a third (so far)
Main Pivot Query Code:
Code:
TRANSFORM Nz(Count([CR_ID])-1,0) AS CR_IDs
SELECT Chng_ReqQry.Level, Nz(Count([CR_ID])-5,0) AS [HB Total], Nz(Count([Level])-5,0) AS [Level Totals]
FROM Chng_ReqQry
WHERE (((Chng_ReqQry.Sub_No)=0) AND ((Chng_ReqQry.Date_Closed) Between Date()-7 And Now()))
GROUP BY Chng_ReqQry.Level
PIVOT Chng_ReqQry.Votes;
Is there a way where I can get the totals for each column that shows up in the Main Pivot Query? So far I have to do this for each one:
[TTL Approved], [TTL CRs], [TTL Deferred], [TTL Denied], [HB Total], [TTL Pending], [TTL Withdrawn]........
Code:
[SELECT Nz(Count([Level]),0) AS [TTL Approved]
FROM Chng_ReqQry
WHERE (((Chng_ReqQry.Votes)="Approved" Or (Chng_ReqQry.Votes)="Approve") AND ((Chng_ReqQry.[Change Requested])<>"Do not delete") AND ((Chng_ReqQry.Date_Closed) Between Now()-7 And Now()) AND ((Chng_ReqQry.Sub_No)=0))
HAVING (((Nz(Count([Level]),0)) Is Not Null));
Then I have to make a query where it summarizes the pivot query and all the other columns totals.
Code:
[SELECT CR_Crosstab.Level, CR_Crosstab.Approved, CR_Crosstab.Denied, CR_Crosstab.Withdrawn, CR_Crosstab.Deferred, CR_Crosstab.Pending, CR_Crosstab.[HB Total] AS [Level Totals], [Total Approved].[TTL Approved], [Total CRS].[TTL CRs], [Total Deferred].[TTL Deferred], [Total Denied].[TTL Denied], [Total HB].[HB Total], [Total Pending].[TTL Pending], [Total Withdrawn].[TTL Withdrawn]
FROM CR_Crosstab, [Total Approved], [Total CRS], [Total Deferred], [Total Denied], [Total HB], [Total Pending], [Total Withdrawn]
GROUP BY CR_Crosstab.Level, CR_Crosstab.Approved, CR_Crosstab.Denied, CR_Crosstab.Withdrawn, CR_Crosstab.Deferred, CR_Crosstab.Pending, CR_Crosstab.[HB Total], [Total Approved].[TTL Approved], [Total CRS].[TTL CRs], [Total Deferred].[TTL Deferred], [Total Denied].[TTL Denied], [Total HB].[HB Total], [Total Pending].[TTL Pending], [Total Withdrawn].[TTL Withdrawn];
The easiest bet would be to total everything in the Pivot query. Can anyone show me how to accomplish this?
Rollup:
Request For information 1: Make a way to insert the desired date into all the queries linked to it (Would still need it if all the queries can go into one pivot query)
Request For information 2: Consolidate all the queries into the 1 pivot query