gpt4 book ai didi

mysql - SSRS 对于不返回行的日期显示默认值 0

转载 作者:行者123 更新时间:2023-11-29 20:33:37 25 4
gpt4 key购买 nike

我希望您能帮助我解决我正在尝试创建的 SSRS 报告折线图的问题。所以现在,我正在查询我们的数据库以获取每天的卡片计数。每张卡都是数据库中的单独行。现在,我的图表使用 cardCounts 的总和作为 Y 轴,对于 X 轴,它使用日期作为类别组。现在的问题是,有几天,根本没有数据,因为我们那天没有创建卡片。因此,折线图不是将这一天包含为 0 值,而是完全跳过这一天(在下图中,2016 年 7 月 16 日这一天完全缺失)。我尝试在数据级别执行此操作,但是当我执行“isnull”时,它仍然不起作用。 Screenshot of issue

这是我正在使用的查询:

SELECT dbo.ProductionSet.PSId,Convert(date,MIN(PSCreateTime)) AS CreateTime,isnull(MAX(dbo.ProductionSet.PSCardsInSet),0) AS CardCount,MAX(PrintJobMaster.PJMBatchid) AS BatchId,
isnull(DATEDIFF(SECOND,MIN(PaperPrintStart.PSTimeOf),MIN(PaperPrintDone.PSTimeOf)),0) AS PaperPrintSecs,
isnull(nullif(DATEDIFF(Minute,MIN(ProductionSet.PSCreateTime),MIN(PaperCopyDone.PSTimeOf)),0),0) AS SecsToPaperOnPress
FROM dbo.ProductionSet WITH (NOLOCK)
LEFT OUTER JOIN PSStats PaperPrintStart WITH (NOLOCK) ON ProductionSet.PSId = PaperPrintStart.PSID AND PaperPrintStart.PSStatTo='1-1' AND PaperPrintStart.PJMID IS NOT NULL
LEFT OUTER JOIN PSStats PaperPrintDone WITH (NOLOCK) ON ProductionSet.PSId = PaperPrintDone.PSID AND PaperPrintDone.PSStatTo='3-3' AND PaperPrintDone.PJMID IS NOT NULL
LEFT OUTER JOIN PSStats PaperCopyStart WITH (NOLOCK) ON ProductionSet.PSId = PaperCopyStart.PSID AND PaperCopyStart.PSStatFrom='PA-D'
LEFT OUTER JOIN PSStats PaperCopyDone WITH (NOLOCK) ON ProductionSet.PSId = PaperCopyDone.PSID AND PaperCopyDone.PSStatTo='PAD-D'
LEFT OUTER JOIN PSStats EncodingStart WITH (NOLOCK) ON ProductionSet.PSId = EncodingStart.PSID AND EncodingStart.PSStatTo='R'
LEFT OUTER JOIN PSStats EncodingDone WITH (NOLOCK) ON ProductionSet.PSId = EncodingDone.PSID AND EncodingDone.PSStatTo='M'
LEFT OUTER JOIN dbo.PrintJobMaster WITH (NOLOCK) ON dbo.PrintJobMaster.PJMPSID=productionset.PSId
WHERE ProductionSet.PSCreateTime >= '7/16/2016' and ProductionSet.PSCreateTime < '7/17/2016' and PaperCopyDone.PSTimeOf is not null
GROUP BY ProductionSet.PSID
ORDER BY MIN(ProductionSet.PSId)

最佳答案

尝试在图表的Values 中使用此表达式。

=Sum(
IIF(ISNOTHING(Fields!CardCount.Value),0,Fields!CardCount.Value)
)

enter image description here

对于 x 轴日期和 y 轴值为空的日期,它将生成 0。

Note that you have two Values series so you have to use the same expression for both fields.

请告诉我这是否有帮助。

关于mysql - SSRS 对于不返回行的日期显示默认值 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38905545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com