我正在尝试在SSRS 2008中自动化报告。但是,我的总计与查询中的内容不匹配。我在SQL中进行了计算,只是将查询复制到我的新数据集中,但SSRS中的总数不正确。
我已经尝试过使用Table和Tablix,有些东西在SSRS中抛出我的结果,但我无法确定它。我甚至尝试过开始一个新项目。可能导致这种情况的任何想法?
QUERY RESULTS:
ContractNbr AVGTurnAround OnTime
H1234 13.08 332
H5678 0.64 997
H9110 1.86 1365
SSRS 2008 RESULTS:
ContractNbr AVGTurnAround OnTime
H1234 45.61 96
H5678 2.33 3
H9110 2.63 583
我之前从未遇到过这个问题,所以我只是在这一点上难过。 提前感谢您的任何意见和建议。
编辑:这是包含计算的代码的副本:
select distinct c1.contractcd
,AVGTAT = case when avg(cast((tat) as decimal (10,2))) is null then '0' else avg(cast((tat) as decimal (10,2))) end
,NOECompletedWithinTimeFrame = case when b.NOECompletedWithinTimeFrame is null then '0' else b.NOECompletedWithinTimeFrame end
,NOECompletedOutsideTimeFrame = case when c.NOECompletedOutsideTimeFrame is null then '0' else c.NOECompletedOutsideTimeFrame end
into #100a
from #contract c1
left join #M100_101 a
on c1.contractcd = a.contractcd
left join (select distinct contractcd
,count(distinct authorization_number) NOECompletedWithinTimeFrame
from #M100_101
where DaysHoursBetweenRequestandNOESent < = '14'
group by contractcd
)b
on c1.contractcd = b.contractcd
left join (select distinct contractcd
,count(distinct authorization_number) NOECompletedOutsideTimeFrame
from #M100_101
where DaysHoursBetweenRequestandNOESent >='15'
group by contractcd
)c
on c1.contractcd = c.contractcd
group by c1.contractcd, b.NOECompletedWithinTimeFrame, c.NOECompletedOutsideTimeFrame
-- FINAL RESULTS
select a.*
,Compliance = case when NOECompletedWithinTimeFrame = '0' then null
else 1 - ((cast((NOECompletedOutsideTimeFrame) as decimal (10,2))/cast ((NOECompletedWithinTimeFrame) as decimal (10,2)))*1) end
from #100a a