1
나는 이와 같은 결과를 얻고 있으며 결과를 아래에서 얻고 있습니다. 하지만 난은이 같은 넣어 마지막피벗 또는 피벗을 사용하여이 결과를 얻는 방법
SELECT DISTINCT LEFT(DATENAME(m, CONVERT(DATE, CONVERT(VARCHAR(10), fcp.DateKey))), 3) + ' ' + CONVERT(VARCHAR(4), year(convert(DATE, CONVERT(VARCHAR(10), fcp.DateKey)))) DatePeriod
,OM.HedisOCMKey AS OutComeMeasureKey
,(
SELECT NumeratorSegmentCnt
FROM Fact.HedisOCMSegments omse
WHERE omse.SegmentLabel = 'Good'
AND omse.HedisOCMKey = OM.HedisOCMKey
) AS Good
,0 AS Fair
,0 AS Poor
,0 AS 'NotCategorised'
FROM fact.HEDISReport fcp WITH (NOLOCK)
INNER JOIN fact.HedisOCM OM WITH (NOLOCK)
ON OM.HEDISReportKey = fcp.HEDISReportKey
INNER JOIN dim.ConditionMetric dc WITH (NOLOCK)
ON dc.ConditionMetricID = OM.MetricID
WHERE fcp.DateKey <= @i_ReportingPeriod
내 외부에 표시하는 데 필요한 :
ConditionPrevalenceKey PopulationConditionCnt PrevalencePercent DatePeriod OutComeMeasureKey Good Fair Poor NotCategorised NotTested GoodPercentage FairPercentage PoorPercentage NotCategorisedPercentage NotTestedPercentage GoodRange FairRange PoorRange NotCategorisedRange NotTestedRange DerivedGoodValue DerivedFairValue DerivedPoorValue DerivedNotCategorised DerivedNotTested ConditionMetricName
18018 252 0.53 Dec-12 34957 35 0 0 0 217 13.89 0 0 0 86.11 Good Fair Poor NC NoData >= 1 0 0 NotCategorized NotTested Chlamydia Screen
그럼 난 내 결과이 같은 설정 얻을 수있는 방법 :
year Legend percent count Derived value field
Dec-12 Good 13.89 35 >= 1
Dec-12 Fair 0 0 0
Dec-12 Poor 0 0 0
Dec-12 NC 0 0 0
나를 제안하시오 ???