Visual Studio - Report Builder Current/Previous Month

Mills, Tim W 20 Reputation points
2025-03-26T18:20:53.1166667+00:00

I'm new to the application and kind of learning on the fly. I'm trying to build a report In Visual Studio where the data is pulled from SQL Management Studio. The report has three columns. One lists different types of Purchases (Direct, Telephone, NSCC, etc), and the next columns are trying to get to sum up the those purchases based Current month, and the other column based on Previous month.

I'm guessing I need to build something as an Expression. Tricky part is the date data from SQL is in a very messy "yyyy-mm-dd hh:mm:ss.xxx" format. Any help on how to achieve this will be greatly appreciated.

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,034 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZoeHui-MSFT 41,446 Reputation points
    2025-03-27T01:53:23.4566667+00:00

    Hi @Mills, Tim W

    You may use sql query to format the date when loading data from sql database.

    Ex:

    SELECT 
      FORMAT(DateColumn, 'yyyy-dd-MM') AS FormattedDate
    FROM YourTable;
    

    Or you may use SSRS expression to format as you want.

    =Format(Fields!ModifiedDate.Value,"dd/MM/yyyy")
    
    
    =FORMAT(Fields!ModifiedDate.Value,"MM-dd-yyyy")
    
    -- Current month
    FORMAT(GETDATE(), 'MMMM yyyy') AS CurrentMonthName,
    -- Previous month
    FORMAT(DATEADD(MONTH, -1, GETDATE()), 'MMMM yyyy') AS PreviousMonthName
    

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.