Wednesday, May 20, 2015

SSRS - How to convert month number into month name

In the real development environment, there are lots of requirements where we need to get the month name from the month number or date field in the SSRS. There are many ways to get the month name from the month number /date which are given below:
  1. By using Format Function
  2. By using Switch Function
  3. By using IIF Function
By using Format function
This function could be very useful if you are pulling the month name from the date field or variable. Here, you need to right click on the Textbox on which you want to display the month name and choose properties. In Textbox properties window, you can do the following things with the Format function as -

<-- It will give you the full name of the month such as January.
=Format(Fields!MonthNumber.Value,"MMMM")  


<-- It will give you the starting three character of the month name such as Jan.    

=Format(Fields!MonthNumber.Value,"MMM")        

By using Switch function
This function comes into the picture if you want to get the month name from the month number. To do this, we need to set the following things in the Textbox properties window as-
<-- It will give you the full name of the month such as January.
=Switch(Fields!MonthNumber.Value = 1, "January", 
                   Fields!MonthNumber.Value = 2, "February",
                   Fields!MonthNumber.Value = 3, "March"................)
Or
<-- It will give you the starting three character of the month name such as Jan.  
=Switch(Fields!MonthNumber.Value = 1, "Jan", 
                   Fields!MonthNumber.Value = 2, "Feb",
                   Fields!MonthNumber.Value = 3, "Mar"................)
By Using the IIF Function
SSRS is fully loaded of lots of function which can be used as per the requirements. This is the lengthy step to get the month name from the month number such as
<-- It will give you the full name of the month such as January.
=IIF(Fields!MonthNumber.Value = 1, "January", IIF(Parameters!Month_Number.Value = 2, "February", ...)))))))))))
Or
<-- It will give you the starting three character of the month name such as Jan. 
=IIF(Fields!MonthNumber.Value = 1, "Jan", IIF(Parameters!Month_Number.Value = 2, "Feb", ...)))))))))))

So, we have a lots of functions which can be used to achieve the requirement. Some of them are very lengthy and need more concentration to apply them. 

17 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thanks for ur useful information

    ReplyDelete
  3. Envision, each time you go on vacation, you're changing money you home cash to the outside cash.convert money online

    ReplyDelete
  4. Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. convert money

    ReplyDelete
  5. Did you realize that when you do this, regardless of whether you're in your nearby trip specialist converting £100 into USD, you're somewhat cheapening the Great British Pound. convert money calculator

    ReplyDelete
  6. These online gateways causes the intrigued brokers to realize the Forex market structure and the rewarding alternatives so as to spare a lot of cash of the speculators. Best South African brokers

    ReplyDelete
  7. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. Vistara customer care

    ReplyDelete
  8. Like other crypto trading bots, there’s limited maintenance required after signup. You don’t need to do anything except monitor the performance of the bot. Auto crypto bot

    ReplyDelete
  9. Are there any "Live" stores that you can assess. This ought to be the best sign, since you can see "live" what you may get. Did the "live" stores require programming? besimple.com/

    ReplyDelete
  10. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks video upload

    ReplyDelete
  11. I liked your article and I hope you will have many entries or more store name ideas

    ReplyDelete
  12. Amazing knowledge and I like to share this kind of information with my friends and hope they like it they why I do more info

    ReplyDelete
  13. The web site is lovingly serviced and saved as much as date. So it should be, thanks for sharing this with us. website

    ReplyDelete
  14. Wow this was amazing. I was just about to look for some expert and educative content like this, I am grateful that I have frequented here! https://givetime.io/

    ReplyDelete
  15. Watch and Download world's famous Turkish action drama Kurulus Osman Season 3 in English on link below
    👇
    Kurulus Osman Season 3

    Kurulus Osman Season 3 Episode 1
    On link below
    Kurulus Osman Season 3 Episode 1

    Crypto trading course
    👇
    Crypto quantum leap

    YouTube course
    Be a professional YouTuber and start your carrier
    Tube Mastery and Monetization by matt
    ... ...

    ReplyDelete