SSRS中的值轴标签更改

时间:2016-03-19 13:56:12

标签: reporting-services ssrs-2008 ssrs-2008-r2

我正在尝试更改SSRS中条形图水平轴的标签文本 尝试使用LabelStyle.Format但未获得正确的值

以下是我试过的表达式

使用IIf案例:

=IIf(Fields!monthId.Value = 0 ,MonthName(Month(DateAdd("m", 0, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 1 ,MonthName(Month(DateAdd("m", -1, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 2 ,MonthName(Month(DateAdd("m", -2, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 3 ,MonthName(Month(DateAdd("m", -3, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 4 ,MonthName(Month(DateAdd("m", -4, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 5 ,MonthName(Month(DateAdd("m", -5, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 6 ,MonthName(Month(DateAdd("m", -6, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 7 ,MonthName(Month(DateAdd("m", -7, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 8 ,MonthName(Month(DateAdd("m", -8, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 9 ,MonthName(Month(DateAdd("m", -9, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 10 ,MonthName(Month(DateAdd("m", -10, Today()))),Nothing) OR
IIf(Fields!monthId.Value = 11 ,MonthName(Month(DateAdd("m", -11, Today()))),Nothing);

这是开关案例

=switch(Fields!monthId.Value = 0 ,MonthName(Month(DateAdd("m", 0, Today())))
,Fields!monthId.Value = 1 ,MonthName(Month(DateAdd("m", -1, Today())))
,Fields!monthId.Value = 2 ,MonthName(Month(DateAdd("m", -2, Today())))
,Fields!monthId.Value = 3 ,MonthName(Month(DateAdd("m", -3, Today())))
,Fields!monthId.Value = 4 ,MonthName(Month(DateAdd("m", -4, Today())))
,Fields!monthId.Value = 5 ,MonthName(Month(DateAdd("m", -5, Today())))
,Fields!monthId.Value = 6 ,MonthName(Month(DateAdd("m", -6, Today())))
,Fields!monthId.Value = 7 ,MonthName(Month(DateAdd("m", -7, Today())))
,Fields!monthId.Value = 8 ,MonthName(Month(DateAdd("m", -8, Today())))
,Fields!monthId.Value = 9 ,MonthName(Month(DateAdd("m", -9, Today())))
,Fields!monthId.Value = 10 ,MonthName(Month(DateAdd("m", -10, Today())))
,Fields!monthId.Value = 11 ,MonthName(Month(DateAdd("m", -11, Today()))))

但两者都给出了上述结果

enter image description here

但是我想要把这样的东西拿出来

enter image description here

请告诉我这里缺少的东西。 谢谢。

1 个答案:

答案 0 :(得分:0)

任何一个表达都应该有用。

这就是你需要的。

  1. 右键单击图表的水平轴或x轴,然后选择“水平轴属性”
  2. 在“水平轴属性”对话框中,选择“数字”。 enter image description here
  3. 从“类别”列表中,选择“日期”。从“类型”列表中,选择要应用于x轴标签的日期格式。

  4. 选择轴选项。

  5. 在“间隔”中,键入1.在“间隔类型”属性中,选择“月”。 enter image description here enter image description here