如何在SSRS 2012中格式化日期

时间:2014-02-04 18:41:22

标签: reporting-services

我遇到了一个我未能完成的问题。 任何帮助,将不胜感激。谢谢

下图显示了我想在MATRIX报告列标题中实现的内容。 日期列中有两个字符串行,我无法使其工作。

enter image description here

=IIF(Fields!ReportType.Value = "GOAL" or Fields!ReportType.Value = "Test GOAL", Fields!ProcessDt.Value,
IIF(Fields!ReportType.Value = "test1"
or Fields!ReportType.Value = "test-2"
or Fields!ReportType.Value = "test3"
or Fields!ReportType.Value = "test4"
or Fields!ReportType.Value = "test5", Format(Cdate(Fields!ProcessDt.Value), "MMM-yyyy"),  Fields!ProcessDt.Value)

谢谢

1 个答案:

答案 0 :(得分:0)

在应用Format

之前,可以将字段显式地转换为日期时间

...Format(CDate(Fields!ProcessDt.Value), "MMM-yyyy")...

对于您的进一步问题,如果您想用特定字符串替换日期,则需要在较大的语句中添加另一个IIf语句,例如:

..IIf(Fields!ProcessDt.Value = "2/2/2014", "Goal1", IIf(...))...