Search code examples
reporting-servicesssrs-2008reportbar-chartssrs-2012

Reporting Service months in x-axis


I have a bar chart that shows values for each month in the year. Therefor my bar chart has 12 values on the x-axis. Now they show the numbers 1-12 but I would like instead of numbers to show the name of each month "Jan"-"Dec" or "January"-"December". How do I do this?

Thanks


Solution

  • If you use the month number try set label x-axis to this:

    Or you can create a calculated field in the dataset and set it to the above expression then use that field in the x-axis label.

    EDIT: I reproduced a possible scenario of your chart.

    This is a chart with month number in x-axis, according to your description it is what you are getting now:

    enter image description here

    The easiest way to get the month name is using a calculated field:

    Right click on dataset, go to Fields tab, click add button and type the name to the field in this case MonthName enter image description here

    In Field Source click on right side button Fx for set the expression and add the following expression:

    =Switch(
    Fields!MonthNumber.Value=1,"January",
    Fields!MonthNumber.Value=2,"February",
    Fields!MonthNumber.Value=3,"March",
    Fields!MonthNumber.Value=4,"April",
    Fields!MonthNumber.Value=5,"May",
    Fields!MonthNumber.Value=6,"June",
    Fields!MonthNumber.Value=7,"July",
    Fields!MonthNumber.Value=8,"August",
    Fields!MonthNumber.Value=9,"September",
    Fields!MonthNumber.Value=10,"October",
    Fields!MonthNumber.Value=11,"November",
    Fields!MonthNumber.Value=12,"December",
    )
    

    Click Ok, and update your chart to use the MonthName field (not the MonthNumber)

    enter image description here

    Right click on MonthName in Category Groups Properties.

    enter image description here

    In sorting tab you should sort by MonthNumber, in my case is [Numero Mes] as follows: enter image description here

    After this you should get the following chart preview. enter image description here

    Let me know if this was helpful.