Saturday, 2 August 2014

SSRS 2008 Column Chart with Line


If you want to create a column chart and have a line across the top showing the numbers in two different ways, it is easy to do in SSRS 2008. Just drag over the data into the data field twice. Right click on the data field on change the chart type to line and the other to column.
Here is a table I used to show this.
SSRS 2008 Column Chart with LineI created a Column chart and dragged over the date and numbers fields as shown.
SSRS 2008 Column Chart with Line


Notice I placed the Number data in the data field twice. Then I right clicked on the data field and select the change chart type option. Then selected line chart.

SSRS 2008 Column Chart with Line
After I select line chart and click OK the chart looks like the image below. It now has columns and lines on the same chart.
SSRS 2008 Column Chart with Line
If you have multiple Series and only want to show for one series in the chart you will need alter the visibility. Here is the chart with a new columns I will use for the series.
SSRS 2008 Column Chart with Line
Refresh the data set and drag over the rep to the series field.
SSRS 2008 Column Chart with Line
Right Click on the data field and go to series properties...
SSRS 2008 Column Chart with Line

Then set the visibility expression. Remember to set it to Not equal to, this is setting who to hide, not who to show.
SSRS 2008 Column Chart with Line

The Chart will show multiple columns and a single line.

SSRS 2008 Column Chart with Line

Friday, 1 August 2014

Split Function In Sql server

CREATE FUNCTION [dbo].[SDF_SplitString]
(
    @sString nvarchar(2048),
    @cDelimiter nchar(1)
)
RETURNS @tParts TABLE ( part nvarchar(2048) )
AS
BEGIN
    if @sString is null return
    declare @iStart int,
      @iPos int
    if substring( @sString, 1, 1 ) = @cDelimiter 
    begin
     set @iStart = 2
     insert into @tParts
     values( null )
    end
    else 
     set @iStart = 1
    while 1=1
    begin
     set @iPos = charindex( @cDelimiter, @sString, @iStart )
     if @iPos = 0
      set @iPos = len( @sString )+1
     if @iPos - @iStart > 0   
      insert into @tParts
      values ( substring( @sString, @iStart, @iPos-@iStart ))
     else
      insert into @tParts
      values( null )
     set @iStart = @iPos+1
     if @iStart > len( @sString ) 
      break
    end
    RETURN

END
Execute: SELECT Part from [dbo].[SDF_SplitString]('CAAB071C-2B5C-4C8C-836C-1EBCDFE6E5D5,318EBFFE-3FE0-4AED-B47F-DCC880ABEAC6',',')A