S
Shreyas Pandit
I have two tables (one table current three week data, and another for
all the project data),
the three week data table lists tasks by IDs and the task status (Ahead
of Schedule, Complete, Delayed, Late, On Time, Postponed)
all project data lists tasks by IDs and the task category (Plan Tasks,
Plan Task for Next Two Weeks, Milestone)
The following query that returns a percentage of a task that has a
given status and is apart of a specific category (so for example the
query would give me the Percent of all Tasks [in both tables] that are
Ahead of Schedule, Complete, Delayed, late, on time, and postponed and
marked as a Plan Tasks)
SELECT
FormatPercent(subQuery1.Instances/subQuery7.Total) AS
PlanTasks_that_are_AheadofSchedule,
FormatPercent(subQuery2.Instances/subQuery7.Total) AS
PlanTasks_that_are_Complete,
FormatPercent(subQuery3.Instances/subQuery7.Total) AS
PlanTasks_that_are_Delayed,
FormatPercent(subQuery4.Instances/subQuery7.Total) AS
PlanTasks_that_are_Late,
FormatPercent(subQuery5.Instances/subQuery7.Total) AS
PlanTasks_that_are_OnTime,
FormatPercent(subQuery6.Instances/subQuery7.Total) AS
PlanTasks_that_are_Postponed
FROM
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Ahead of Schedule" AND RawData.Category="Plan
Tasks"]. AS subQuery1,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Complete" AND RawData.Category="Plan Tasks"].
AS subQuery2,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Delayed" AND RawData.Category="Plan Tasks"]. AS
subQuery3,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Late" AND RawData.Category="Plan Tasks"]. AS
subQuery4,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="On Time" AND RawData.Category="Plan Tasks"]. AS
subQuery5,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Postponed" AND RawData.Category="Plan Tasks"].
AS subQuery6,
[SELECT COUNT(ThreeWeekStatus.Status) AS Total FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId].
AS subQuery7;
so each query is for a category (plan tasks, plan tasks for 2 weeks,
milestones) and the fourth the total
What i would like to do is have just one query, rather then four
different ones so i can make a graph... the output of the query could
be
Name | Ahead of Schedule | Complete | Delayed | Late | On Time |
Postponed
Plan Tasks | % of tasks | % of tasks | % of tasks | % of tasks | % of
tasks | % of tasks
Plan Task for Next Two Weeks | % of tasks | % of tasks | % of tasks | %
of tasks | % of tasks | % of tasks
Milestone | % of tasks | % of tasks | % of tasks | % of tasks | % of
tasks | % of tasks
Total | % of tasks | % of tasks | % of tasks | % of tasks | % of tasks
| % of tasks
so i guess i need to know how would you create a new row?
the columns are the same its just that the four queries have different
data for those columns, so i would need four rows. Is it possible in
access to manually create rows in a query?
I perfer a query over a table since the data is dynamic and needs to be
graphed.
all the project data),
the three week data table lists tasks by IDs and the task status (Ahead
of Schedule, Complete, Delayed, Late, On Time, Postponed)
all project data lists tasks by IDs and the task category (Plan Tasks,
Plan Task for Next Two Weeks, Milestone)
The following query that returns a percentage of a task that has a
given status and is apart of a specific category (so for example the
query would give me the Percent of all Tasks [in both tables] that are
Ahead of Schedule, Complete, Delayed, late, on time, and postponed and
marked as a Plan Tasks)
SELECT
FormatPercent(subQuery1.Instances/subQuery7.Total) AS
PlanTasks_that_are_AheadofSchedule,
FormatPercent(subQuery2.Instances/subQuery7.Total) AS
PlanTasks_that_are_Complete,
FormatPercent(subQuery3.Instances/subQuery7.Total) AS
PlanTasks_that_are_Delayed,
FormatPercent(subQuery4.Instances/subQuery7.Total) AS
PlanTasks_that_are_Late,
FormatPercent(subQuery5.Instances/subQuery7.Total) AS
PlanTasks_that_are_OnTime,
FormatPercent(subQuery6.Instances/subQuery7.Total) AS
PlanTasks_that_are_Postponed
FROM
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Ahead of Schedule" AND RawData.Category="Plan
Tasks"]. AS subQuery1,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Complete" AND RawData.Category="Plan Tasks"].
AS subQuery2,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Delayed" AND RawData.Category="Plan Tasks"]. AS
subQuery3,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Late" AND RawData.Category="Plan Tasks"]. AS
subQuery4,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="On Time" AND RawData.Category="Plan Tasks"]. AS
subQuery5,
[SELECT COUNT(ThreeWeekStatus.Status) AS Instances FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId AND
ThreeWeekStatus.Status="Postponed" AND RawData.Category="Plan Tasks"].
AS subQuery6,
[SELECT COUNT(ThreeWeekStatus.Status) AS Total FROM RawData,
ThreeWeekStatus WHERE RawData.OutlineNumber=ThreeWeekStatus.TaskId].
AS subQuery7;
so each query is for a category (plan tasks, plan tasks for 2 weeks,
milestones) and the fourth the total
What i would like to do is have just one query, rather then four
different ones so i can make a graph... the output of the query could
be
Name | Ahead of Schedule | Complete | Delayed | Late | On Time |
Postponed
Plan Tasks | % of tasks | % of tasks | % of tasks | % of tasks | % of
tasks | % of tasks
Plan Task for Next Two Weeks | % of tasks | % of tasks | % of tasks | %
of tasks | % of tasks | % of tasks
Milestone | % of tasks | % of tasks | % of tasks | % of tasks | % of
tasks | % of tasks
Total | % of tasks | % of tasks | % of tasks | % of tasks | % of tasks
| % of tasks
so i guess i need to know how would you create a new row?
the columns are the same its just that the four queries have different
data for those columns, so i would need four rows. Is it possible in
access to manually create rows in a query?
I perfer a query over a table since the data is dynamic and needs to be
graphed.