Search code examples
reporting-servicesssrs-2008ssrs-2012

Vertical strip line


Trying to create a vertical strip line on a particular date on my x-axis, like the below picture, which is a reporting services chart which has been copied into excel and then the strip line put on top.

enter image description here

I Have tried: In Striplines on the x-axis I have set the Interval Offset to the following

=IIF(Fields!yyyy_mm.value = "Dec, 2016", 1 ,0)

and Width as 2, but I'm getting nothing show up on my chart.


Solution

  • If yyyy-mm is a text value, the IntervalOffset should be a number that aligns to the number of X-axis categories. An IntervalOffset of 3 will start the StripLine on your third month, or 3.5 will start it between your third and fourth month.

    If you don't know where on your X-axis December 2016 will be, you can use an expression and count the X-axis values smaller than the one you want:

    =CountDistinct(IIF(Fields!YYYY_MM.Value <= "2016-12", Fields!YYYY_MM.Value, nothing)) -0.5
    

    If yyyy-MM is a date value, you can use a date as the IntervalOffset value. You will need to convert it to an OLE Automation date value, but the expression is simple:

    =CDate("01-DEC-2016").ToOADate