我客户的财政年度从 11 月开始。我使用以下表达式对会计月份类别进行排序:
=Month(
DateAdd(
DateInterval.Month,
-10,
CDate(
Fields!FiscalMonth.Value + ", 01 1900"
)
)
)
在我不得不将上一年的年终值添加到该类别之前,它运行良好。我认为使用这样的表达式进行排序是微不足道的:
=Iif(
Fields!FiscalMonth.Value = "YearEnd",
0,
Month(
DateAdd(
DateInterval.Month,
-10,
CDate(
Fields!FiscalMonth.Value + ", 01 1900"
)
)
)
)
Conversion from string "YearEnd, 01 1900" to type 'Date' is not valid
但它在值上抛出错误YearEnd
。这应该是不可能的,因为Iif
应该保护它的第二个参数。我还能如何确保为“YearEnd”分配了 0 排序顺序?
更新:
即使使用以下表达式也会发生错误:
=Iif(
Fields!FiscalMonth.Value = "YearEnd",
0,
CDate(
Fields!FiscalMonth.Value + ", 01 1900"
)
)
但不会发生
=Iif(
Fields!FiscalMonth.Value = "YearEnd",
0,
Fields!FiscalMonth.Value + ", 01 1900"
)
对我来说,这听起来像是 SSRS在评估第一个参数CDate()
之前进行评估。Iif()
一个错误。