Graph: Dynamic Date for X Axis

  • Hi SSC readers, my first post on here.

    I've been using RS for a little while now, but decided to get a little more experimental with what I am doing.

    To be honest I have tried various expressions without luck. I want to make the x axis of my graph show the last 7 days of activity from my data.

    Can anyone help me out or is this even possible to do as an expression. I would prefer to do it via the expression, than do it with an outer join in the Data source for the graph. As some days the value maybe be zero.

    Kind regards,

    David

  • The Method I use is the filter tab inside the category groups.  There is also a filter tab in the chart properties that you can use.  My report uses a filter on a parameter, however you should be able to set a filter like the one below either on the chart properties main or within the Data groupings. 

    Fields!YourDate.Value --- >= --- =Today.AddDays(-7)

    HTH,

     

    Jim

  • Thanks for the reply Jim,

    I understand how I can filter the last 7 days in the graph, but that isn't the problem.

    If for example the data for 3 days ago was null, then the graph will miss this day out completely and won't show that there was a day with zero, this would look a misleading graph.

    I have had to take the following route for now, for years rather than days in this case. Basically I've had to handle it at the data stage rather than within RS. I did a outer join against this table, to give me the last 5 years of data, even if it is null in the other table.

    ALTER VIEW SPH_Acad_Years

    AS

    SELECT *

    FROM

    (

    SELECT datepart(yyyy,getdate()) as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-1 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-2 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-3 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-4 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-5 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-6 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-7 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-8 as Acad_Year

    UNION ALL

    SELECT datepart(yyyy,getdate())-9 as Acad_Year

    ) x

    WHERE Acad_Year BETWEEN dbo.lfn_SPH_LowerYear() AND dbo.lfn_SPH_UpperYear()

Viewing 3 posts - 1 through 2 (of 2 total)

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