calculate 12 months of data from a given date from a user

  • I have a query that it seems to be off dont know what wrong but I need to show last 12 months of data based off a user input for a date.

    my query is this. My results show different in SSRS.

    12 months data

    /*Declare @Date as Date = '11/1/2022' 
    Declare @prop as int = 8000
    --*/SELECT
    tblPropsFreeRent.intProp,
    tblPropsFreeRent.dtMonth,
    DATENAME(m, tblPropsFreeRent.dtMonth) + ' ' + DATENAME(yyyy, tblPropsFreeRent.dtMonth) AS strDate,
    intNumTimes AS intNumTimes,
    tblPropsFreeRent.mnyAmount AS curAmount,
    intMoveIns AS intMoveIns,
    W.fltOcc AS fltOcc
    FROM
    tblPropsFreeRent
    LEFT JOIN
    SovranMisc.dbo.tblPropsLateFeeWaive W
    ON tblPropsFreeRent.intProp = W.intProp
    AND tblPropsFreeRent.dtMonth = W.dtMonth
    WHERE
    tblPropsFreeRent.dtMonth >= dateadd(YEAR, -1, @Date)
    and tblPropsFreeRent.intProp IN(@Prop)
  • Your 12 months data picture didn't come through.

    Please provide DDL & sample input data, & show the expected results vs. the actual results

  • Check SSRS caching-https://learn.microsoft.com/en-us/sql/reporting-services/report-server/set-report-processing-properties?redirectedfrom=MSDN&view=sql-server-ver16

  • 12 months data

  • Please provide DDL & sample input data, & show the expected results vs. the actual results

    How about a CREATE TABLE and INSERT scripts so we have actual data and not a picture we can't read?

    Forum Etiquette: How to post data/code on a forum to get the best help

    Get correct answers to your SQL forum questions faster by making it easier to load your sample data and read your code.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply