Showing posts with label SSRS. Show all posts
Showing posts with label SSRS. Show all posts

Monday, 13 October 2014

SQL Server Reporting Services - Creating Professional Tool Tips

Creating tools tips in SSRS charts is very straightforward, simply right click on the series in the chart and then select Series Properties.




Then you can choose one of the fields in the data set as the tool tip using the drop down arrow.




This gives quite basic information but you can create a more customised tool tip using the fx button. Once you are in the function section you can


  • Add labels
  • Include the position on the X or Y axis
  • Show multiple pieces of information on separate lines
  • Format numbers using commas or decimal point accuracy



The code to achieve this is

="Channel: " + Fields!Channel.Value & VbCrLf + "Day" + ": "  + Fields!DayNameOfWeek.Value &  VbCrLf  + "Orders" + ": " +  FormatNumber(CStr(SUM(Fields!Tickets.Value)), 0)


The spaces between the lines can be created by & VbCrLf

When using numbers you must cast it as a string using CStr() around the field value. By wrapping the string with FormatNumber( , 0) you can format the way a number appears. This will include a comma between thousands and not include any decimal places. If you change the 0 to 2 you will include two decimal places.

All of the strings can be concatenated together using the + character. Labels can be created by enclosing text in between quotation marks. 

Sunday, 6 October 2013

SSRS - Order By Day Of The Week

In SQL Reporting Services there is no out of the box way of order a report or chart by the days of the week. If you try to order by the name you end up with the days alphabetically sorted which is not very helpful.



One of the ways around this is to click use a switch statement in the Sort By section.

=SWITCH(Fields!DateNamePart.Value = "Monday", 1, Fields!DateNamePart.Value = "Tuesday", 2, Fields!DateNamePart.Value = "Wednesday", 3, Fields!DateNamePart.Value = "Thursday", 4, Fields!DateNamePart.Value = "Friday", 5, Fields!DateNamePart.Value = "Saturday", 6, Fields!DateNamePart.Value = "Sunday", 7)

After you have added this the days are now sorted in order and the data now has some visual value and it is much easier to spot when the trend in the chart.


Thursday, 6 December 2012

SSRS 2008 R2 - Alternate Bar Chart Colours

A simple Bar Chart or Column Chart in SQL Services Reporting Services (SSRS) that only has one category group can look a bit boring.


An easy way to make it a bit more interesting on the eye is to change the fill colour on the bars (or columns) for the alternating ones.




Right click on the series and select Series Properties.



Select Fill and then click on the expression button.



In the expression box simply paste in the same code you use to alternate rows in a table.

=IIF(RunningValue(Fields!County_Name.Value,COUNTDISTINCT,NOTHING) MOD 2 = 0, "#4573D5","#7399EA")

In this case I'm using colour codes #4573D5 and #7399EA but you can also use names like this:

=IIF(RunningValue(Fields!County_Name.Value,COUNTDISTINCT,NOTHING) MOD 2 = 0, "LightGrey","White")


Your chart will now be a bit more pleasing on the eye.