Bill said:
As promises.
SQL:-
TRANSFORM Count([q_fixtimes by assignee team - part2].CallID) AS
CountOfCallID
SELECT [q_fixtimes by assignee team - part2].Team, [q_fixtimes by
assignee team - part2].Priority, [q_fixtimes by assignee team -
part2].FixStatus, Count([q_fixtimes by assignee team - part2].CallID) AS
[Total Of CallID]
FROM [q_fixtimes by assignee team - part2]
GROUP BY [q_fixtimes by assignee team - part2].Team, [q_fixtimes by
assignee team - part2].Priority, [q_fixtimes by assignee team -
part2].FixStatus
PIVOT [q_fixtimes by assignee team - part2].CallMonth In
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
Cut down version of the data:-
q_fixtimes by assignee team - part2_Crosstab Team Priority FixStatus
Total Of CallID Jan Feb Mar Apr
System Support 1C FixTime Exceeded 40 3 2 4 3
System Support 1C FixTime Met 178 20 12 12 16
System Support 2U FixTime Exceeded 121 10 11 13 8
System Support 2U FixTime Met 153 16 33 11 9
System Support 3M FixTime Exceeded 215 35 16 11 15
System Support 3M FixTime Met 343 64 40 32 27
System Support 3M WIP Still FixTime 3
System Support 4L FixTime Exceeded 14 3 3 1 1
System Support 4L FixTime Met 34 5 4 6 2
The rows of data are nearly always in pairs but occasionally there will
be a third row as in the example.
I think it will also be possible for there just to be one row of data
occasionally.
What I require is that instead of the values I return percentages. So in
the case of the 1C priorities above for the month of Jan the calculation
I need is.
It looks here like you are using "TotalOf CallID"
instead of counts for Jan? Did you mean?
3/3 + 20
and
20/3 + 20
40/(40+178)
and
178/(40+178)
I wonder if it wouldn't be more efficient "relationally"
to roll your own crosstabs for a Team/Priority/FixStatus
group and a Team/Priority group, then join those 2 queries...
{I'm not going change negative counts w/Abs() function
because I am lazy typist, but hopefully you know...}
qryTPF
SELECT
q.Team,
q.Priority,
q.FixStatus,
Count(q.CallID) AS TPFTotCnt,
Sum(q.CallMonth="Jan") AS JanTPF,
Sum(q.CallMonth="Feb") As FebTPF,
Sum(q.CallMonth="Mar") As MarTPF,
Sum(q.CallMonth="Apr") As AprTPF,
Sum(q.CallMonth="May") As MayTPF,
{etc.}
FROM
[q_fixtimes by assignee team - part2] As q
GROUP BY
q.Team,
q.Priority,
q.FixStatus;
qryTP
SELECT
q.Team,
q.Priority,
Count(q.CallID) AS TPTotCnt,
Sum(q.CallMonth="Jan") AS JanTP,
Sum(q.CallMonth="Feb") As FebTP,
Sum(q.CallMonth="Mar") As MarTP,
Sum(q.CallMonth="Apr") As AprTP,
Sum(q.CallMonth="May") As MayTP,
{etc.}
FROM
[q_fixtimes by assignee team - part2] As q
GROUP BY
q.Team,
q.Priority;
I may be completely wrong but I imagine joining
these 2 queries on Team and Priority, then performing
your calculations.