@tsmith Well, here is the whole code, maybe this will make more sense to you.
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="Description" DataValueField="ResourceGrpID">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:XXXXXX %>" SelectCommand="select ResourceGrpID, Description
FROM ERP.ResourceGroup
WHERE ResourceGrpID<>‘DIES’ and ResourceGrpID<>‘DIG DIES’ and ResourceGrpID<>‘PICKERS’ and Inactive<>1
ORDER BY Description"></asp:SqlDataSource>
<asp:Chart ID=“Chart1” runat=“server” DataSourceID=“SqlDataSource1” OnLoad=“Chart1_Load” Height=“900px” Width=“1500px”>
<asp:Series BorderColor=“Green” ChartType=“StackedBar” Color=“Green” Name=“Series1” XValueMember=“Date” YValueMembers=“LoadHours” Font=“Microsoft Sans Serif, 12pt, style=Bold” IsValueShownAsLabel=“True” LabelForeColor=“White” LabelFormat="#.##">
</asp:Series>
<asp:Series BorderColor=“Green” ChartArea=“ChartArea1” ChartType=“StackedBar” Color=“White” Name=“Series2” XValueMember=“Date” YValueMembers=“AvailableHours” Font=“Microsoft Sans Serif, 12pt, style=Bold” IsValueShownAsLabel=“True” LabelForeColor=“Green” LabelFormat="#.##">
</asp:Series>
<asp:Series BorderColor=“Red” ChartArea=“ChartArea1” ChartType=“StackedBar” Color=“Red” Name=“Series3” XValueMember=“Date” YValueMembers=“OverloadHours” Font=“Microsoft Sans Serif, 12pt, style=Bold” IsValueShownAsLabel=“True” LabelForeColor=“White” LabelFormat="#.##">
</asp:Series>
<asp:ChartArea Name=“ChartArea1”>
</asp:ChartArea>
</asp:Chart>
<asp:SqlDataSource ID=“SqlDataSource1” runat=“server” ConnectionString="<%$ ConnectionStrings:ERP10ConnectionString %>" SelectCommand="select
[ShopCap].[ResourceGrpID] as [ResourceGrpID],
convert(nvarchar(20),[ShopCap].[LoadDate]) as [Date],
case when [ShopCap].[LoadDate] = convert(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end as
[Capacity],
cast((avg(Load.Calculated_Load)) as decimal(9,2)) - case when (cast((avg(Load.Calculated_Load)) as decimal(9,2)) > case when [ShopCap].[LoadDate] = convert
(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end) then (cast((avg(Load.Calculated_Load)) as decimal(9,2)) -
case when [ShopCap].[LoadDate] = convert(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end) else 0 end as [LoadHours],
case when (cast((avg(Load.Calculated_Load)) as decimal(9,2)) > case when [ShopCap].[LoadDate] = convert
(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end) then 0 else ((case when [ShopCap].[LoadDate] = convert
(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end) - cast((avg(Load.Calculated_Load)) as decimal(9,2))) end
as [AvailableHours],
case when (cast((avg(Load.Calculated_Load)) as decimal(9,2)) > case when [ShopCap].[LoadDate] = convert
(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end) then (cast((avg(Load.Calculated_Load)) as decimal(9,2)) -
case when [ShopCap].[LoadDate] = convert(date,getdate()) then 0 else (sum(ShopCap.Capacity)) end) else 0 end as
[OverloadHours]
from Erp.ShopCap as ShopCap
inner join Erp.Resource as Resource on
ShopCap.Company = Resource.Company
And
ShopCap.ResourceGrpID = Resource.ResourceGrpID
And
ShopCap.ResourceID = Resource.ResourceID
and ( Resource.Inactive = 0 )
left outer join (select
[JobOpDtl].[ResourceGrpID] as [JobOpDtl_ResourceGrpID],
(case when JobHead.ReqDueDate <= getdate() then convert(date, getdate()) else JobHead.ReqDueDate end) as
[Calculated_LoadDate],
(sum(((case when JobOper.SetupComplete = 0 then JobOper.EstSetHours else 0 end))+((case when
JobOper.QtyCompleted > 0 and JobOper.RunQty > 0 then JobOper.EstProdHours - (JobOper.QtyCompleted/JobOper.RunQty)
*JobOper.EstProdHours else JobOper.EstProdHours end)))) as [Calculated_Load]
from Erp.JobOpDtl as JobOpDtl
inner join Erp.JobOper as JobOper on
JobOpDtl.Company = JobOper.Company
And
JobOpDtl.JobNum = JobOper.JobNum
And
JobOpDtl.AssemblySeq = JobOper.AssemblySeq
And
JobOpDtl.OprSeq = JobOper.OprSeq
and ( JobOper.OpComplete = 0 )
inner join Erp.JobHead as JobHead on
JobOper.Company = JobHead.Company
And
JobOper.JobNum = JobHead.JobNum
and ( JobHead.JobReleased = 1 and JobHead.JobComplete = 0 )
where (JobOpDtl.ResourceGrpID = @Grp)
group by [JobOpDtl].[ResourceGrpID],
(case when JobHead.ReqDueDate <= getdate() then convert(date, getdate()) else JobHead.ReqDueDate end)) as
Load on
ShopCap.ResourceGrpID = Load.JobOpDtl_ResourceGrpID
And
ShopCap.LoadDate = Load.Calculated_LoadDate
where (ShopCap.ResourceGrpID = @Grp and ShopCap.ResourceID <> ‘’ and ShopCap.LoadDate >= convert(date, GETDATE
()) and ShopCap.LoadDate < DATEADD (week, 2, convert(date,GETDATE())))
group by [ShopCap].[ResourceGrpID],
[ShopCap].[LoadDate]
order by ShopCap.LoadDate ASC">
<asp:ControlParameter ControlID=“DropDownList1” DefaultValue="%" Name=“Grp” PropertyName=“SelectedValue” />
</asp:SqlDataSource>