Using MS Access I have two cross tab queries summarizing my data. One gets me the total count of the rows of data by location and fiscal quarter; the other query gets me the percent that meet a criteria by location and fiscal quarter.
Examples below (they are simplified for the sake of the question).
qryA: original summary table
Location Period CountIt
Blue FY13-Q3 Yes
Orange FY13-Q1 No
Blue FY14-Q1 No
Orange FY13-Q1 Yes
I then have one cross tab that is getting the % of Yes
values from the CountIt
column and another that displays the total count for each fiscal quarter.
crossstab #1 - percentages
TRANSFORM Sum(IIf(qryA.CountIt Like "Yes",1,0))/Count(qryA.CountIt) AS PercentYes
SELECT qryA.[Location]
FROM qryA
GROUP BY qryA.[Location]
PIVOT qryA.[Period];
## Crosstab Output
Location FY13-Q1 FY13-Q2 FY13-Q3 FY13-Q4 FY14-Q1
Blue 12% 15% 13.2% 19% 15%
Orange 9% 12% 1% 18% 12%
crossstab #2 - count it
TRANSFORM Count(qryA.CountIt) AS FiscalCount
SELECT qryA.[Location]
FROM qryA
GROUP BY qryA.[Location]
PIVOT qryA.[Period];
## Crosstab that display total count by location and Fiscal quarter
Location FY13-Q1 FY13-Q2 FY13-Q3 FY13-Q4 FY14-Q1
Blue 102 111 54 124 122
Orange 91 321 122 158 129
desired final output
I want to createa a combined table that shows the % of Yes and the total count
FY13-Q1 FY13-Q2 FY13-Q3 FY13-Q4 FY14-Q1
Location Per% Tot Per% Tot Per% Tot Per% Tot Per% Tot
Blue 12% 102 15% 111 13.2% 54 19% 124 15% 122
Orange 9% 91 12% 321 1% 122 18% 158 12% 129
Is this possible to do? As you can see, my row headers are fiscal periods and, as I add more data, I will be getting more rows (they are dynamic) ... I'm not sure how to union these into the desire result.
Thanks!