how do i get the previous month last day based on a parameter value?

Anonymous
2022-09-20T15:06:39.307+00:00

I have a parameter report date based on that report date i habe a text box that says "Previos A/R amount "this is where I need the last day of the previous month based on that parameter. The code that I have not quite working. It still gives me the same month that the user selects not the previous.
="Previous Months A/R:" & " " & "(as of" & " " &DateSerial(Year(Parameters!ReportDate.Value),Month(Parameters!ReportDate.Value)-2,Day(Parameters!ReportDate.Value)) &")"

243085-error.png

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.
2,878 questions
0 comments No comments
{count} votes

Accepted answer
  1. AniyaTang-MSFT 12,421 Reputation points Microsoft Vendor
    2022-09-21T02:00:04.873+00:00

    Hi @Jannette Jones
    Do you mean that you want to calculate the last day of the previous month for the date of the parameter report date? Then you can use this expression:

    ="Previous Months A/R:" & " " & "(as of" & " " &DateAdd("d", -1, DateSerial(Year(Parameters!ReportDate.Value), Month(Parameters!ReportDate.Value), 1)) &")"  
    

    Preview:
    243138-1.png
    Best regards,
    Aniya


0 additional answers

Sort by: Most helpful