none
Quarter() function in SSRS

    Question

  • I am uisng VS 2005 to build reports for SQL 2005. The problem is with getting the  Quarter() function, mentioned in the BOL, to work in the report builder. When I build an expression and try to use the function as noted in the BOL I receive an error stating that the name "Quarter" is not declaired. When I use the expression builder to build the expression the function is not available in the builder, which is probably why I get the error. 

     

    I am assuming there is some sort of service pack of hot fix I need to apply to my VS but have not been able to locate which one. I have verified that I have all of the recent service packs applied for VS and SQL server 2005 but I am still unable to see/use this function.

     

    Any help would be greatly appreciated. I need this function for my financial reports.

    Wednesday, August 01, 2007 5:45 PM

All replies

  • Using the QUARTER(datetime) function does not seem to be available in SQL 2005 SSRS;

     

    =Quarter(today())

     

    Results in an error.

     

    After playing with the date part function I was able to resolve my problem. If you are having a similar problem use the following function to extract the quarter from a date

     

    =DatePart(DateInterval.Quarter,today())

     

    Replace Today() with the date you want to get the value for. You can test this by creating a report and placing a textbox anywhere on the report and setting the above code as the expression for the value of the textbox.

     

     

     

     

     

     

     

     

     

    • Proposed as answer by Noman Rao Tuesday, May 29, 2012 8:38 AM
    Wednesday, August 01, 2007 6:07 PM