SSRS 中的财政年度从日期

Financial Year in SSRS from date

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

举个例子

显示 01/04/2018 的日期。财政年度列将 return 2018 显示 31/03/2018 的日期。财政年度列将 return 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

有什么想法吗?

您可以在 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