Visual Studio创建饼图栏

时间:2018-03-15 22:42:27

标签: reporting-services charts

有没有办法创造一个" Pie of Pie" Visual Studio中的饼图如excel?我试图在Visual Studios中重新创建这个饼图,但我不确定如何获得"其他,18"类别扩展为条形图。

enter image description here

/*Total by Behavior (Pivot Tab)*/
SELECT 
CASE WHEN t.EventGroup = 'Less Than 4 Events' THEN SUM(t.Total) ELSE t.Total END AS TotalCount
, EventGroup
, EventLocation
FROM 
(
SELECT
 COUNT(IncidentNumber) AS Total
, CASE WHEN COUNT(IncidentNumber) <=4 THEN 'Less Than 5 Events' ELSE 
    CASE WHEN [Event Location] = 'HLMED' AND COUNT(IncidentNumber) >= 4 THEN 'MED'
            WHEN [Event Location] = 'HLRAD' AND COUNT(IncidentNumber) >= 4 THEN 'Imaging'
            WHEN [Event Location] IN ('HLOR','HLPACU') AND COUNT(IncidentNumber) >= 4 THEN 'OR/RR'
            WHEN [Event Location] IN ('HLNR','HLOB','HLLD') AND COUNT(IncidentNumber) >= 4 THEN 'OB/LD/NR'
            WHEN [Event Location] = 'HLCV' AND COUNT(IncidentNumber) >= 4 THEN 'PCU'
            WHEN [Event Location] IN ('HLICU','HLPACUOV') AND COUNT(IncidentNumber) >= 4 THEN 'ICU'
            WHEN [Event Location] = 'HLLAB' AND COUNT(IncidentNumber) >= 4 THEN 'LAB'
            WHEN [Event Location] = 'HLSUR' AND COUNT(IncidentNumber) >= 4 THEN 'Surg-Ped'
            WHEN [Event Location] = 'HLRT' AND COUNT(IncidentNumber) >= 4 THEN 'RT'
            WHEN [Event Location] = 'HLFANS' AND COUNT(IncidentNumber) >= 4 THEN 'FANS'
            WHEN [Event Location] = 'HLBUSOFF' AND COUNT(IncidentNumber) >= 4 THEN 'BIZ OFFICE'
            WHEN [Event Location] = 'HLPHA' AND COUNT(IncidentNumber) >= 4 THEN 'PHARM'
            WHEN [Event Location] = 'HLPSYCH' AND COUNT(IncidentNumber) >= 4 THEN 'BH'
            ELSE [Event Location] END 
            END AS EventGroup
        ,CASE WHEN [Event Location] = 'HLMED' THEN 'MED'
            WHEN [Event Location] = 'HLRAD' THEN 'Imaging'
            WHEN [Event Location] IN ('HLOR','HLPACU') THEN 'OR/RR'
            WHEN [Event Location] IN ('HLNR','HLOB','HLLD') THEN 'OB/LD/NR'
            WHEN [Event Location] = 'HLCV' THEN 'PCU'
            WHEN [Event Location] IN ('HLICU','HLPACUOV') THEN 'ICU'
            WHEN [Event Location] = 'HLLAB' THEN 'LAB'
            WHEN [Event Location] = 'HLSUR' THEN 'Surg-Ped'
            WHEN [Event Location] = 'HLRT' THEN 'RT'
            WHEN [Event Location] = 'HLFANS' THEN 'FANS'
            WHEN [Event Location] = 'HLBUSOFF' THEN 'BIZ OFFICE'
            WHEN [Event Location] = 'HLPHA' THEN 'PHARM'
            WHEN [Event Location] = 'HLPSYCH' THEN 'BH'
            ELSE [Event Location] END AS EventLocation
FROM vw
WHERE Facility_MisFacID = 'HMC'
AND [Event Location] NOT IN ('HLECFE','HLECFN','HLECFS','HLED','HLSECURITY','HLEOC','HLIT','HLMSSNF','HLHPOC','HLED')
--AND EventDateTime >= '2017-01-01'
AND EventDateTime BETWEEN @StartDate AND @EndDate
AND [Order] = 1
AND IncidentType_RmIncidentTypeID = 'BEH'
GROUP BY [Event Location]
) t
GROUP BY t.Total, t.EventGroup, t.EventLocation
OPTION (OPTIMIZE FOR UNKNOWN)

0 个答案:

没有答案