SSRS的财政年度从日期开始

时间:2018-04-27 10:45:05

标签: date reporting-services financial fiscal

我正在尝试让SSRS显示发布日期的财政年度

作为一个例子

显示01/04/2018的日期。财政年度专栏将于2018年返回 显示31/03/2018的日期。财政年度专栏将于2017年返回

SELECT

IIF(Month(rTranslog.IssueDate)<=3, Year(rTranslog.IssueDate)-1, 
Year(rTranslog.IssueDate)) AS [FY}

,rTranslog.IssueDate
,rTranslog.Site
,rTranslog.NSVCode
,rProduct.LabelDescription
,rTranslog.Ward
,SUM(rTranslog.Qty) AS Quantity
,SUM(rTranslog.Cost)/100 AS CostGBP

FROM

rTranslog
INNER JOIN rProduct
ON rTranslog.NSVCode = rProduct.NSVCode

GROUP BY
rTranslog.IssueDate
,rTranslog.Site
,rTranslog.NSVCode
,rProduct.LabelDescription
,rTranslog.Ward

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您可以使用SSRS中的表达式(如下所示)计算财务年度

= Iif( Month(Fields!calendardate.Value)<=3, Year(Fields!calendardate.Value)-1, Year(Fields!calendardate.Value))

对于SQL:

CASE WHEN Month(rTranslog.IssueDate)<=3 THEN YEAR(rTranslog.IssueDate)-1 ELSE YEAR(rTranslog.IssueDate) END