0
votes

I am trying to change the label text of the Horizontal Axis of Bar chart IN SSRS Tried with LabelStyle.Format but not getting proper values

following are the expression i tried

With IIf Case:

=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);

This is with switch case

=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()))))

But both giving above result

enter image description here

But i want out put something like this

enter image description here

Please let me know what i am missing here. Thank you.

1

1 Answers

0
votes

Either expression should work.

Here's what you need.

  1. Right-click the horizontal, or x-axis, of the chart, and select Horizontal Axis Properties
  2. In the Horizontal Axis Properties dialog box, select Number. enter image description here
  3. From the Category list, select Date. From the Type list, select a date format to apply to the x-axis labels.

  4. Select Axis Options.

  5. In Interval, type 1. In Interval type property, select Months. enter image description here enter image description here