如何计划任务的每月摘要。显示曲线图

时间:2017-03-08 09:28:28

标签: sql sql-server tsql

这是我从谷歌搜索日志以解决以下挑战后的第一个问题。

我想显示Planned VS的曲线图。将显示实际图表,以便管理层可以检查项目落后于计划的程度。

我的计划表结构如下

表1:ProjectTasks

Project ID
Task ID
Expected Start Date
Expected Finished Date
Task Weightage
Percent Complete
TaskGroup

表2:ProjectDepartmentWeightage

Project ID
Department
Weightage
TaskGroup

我想要的结果是:

[Month-1:10%],[Month-2,:20%],[Month-3:5%] .... ==100

我尝试了以下查询,但没有效果。

select 'M-'+convert(nvarchar(10),
       ROW_NUMBER() OVER(ORDER BY (SELECT 1))) AS ItemNo,
       (ProjectDeptWeightage.Weightage * sum(TaskWeightage)/100) as prog 
from       ProjectTasks
inner join ProjectDeptWeightage 
on         ProjectDeptWeightage.ProjectID = ProjectTasks.ProjectID 
and        ProjectDeptWeightage.ResourceID = ProjectTasks.TaskGroup
where      ProjectTasks.ProjectID = 2244 
group by   year(EFDate),month(EFDate),ProjectDeptWeightage.Weightage

0 个答案:

没有答案