Search code examples
reporting-servicesssrs-2008ssrs-2008-r2

SSRS Sorting and Renaming an Empty String


I'm building a bar chart that has many values and one of the values is an empty string. When added in SSRS, the blank string returns a '1' value (The first bar on the chart). How do I change the name from '1' to Blank? Also, how do I sort an Blank string within the chart?

enter image description here

Here's what I tried on changing the name to 'Blank' and it doesn't seem seems to be working:

=iif (IsNothing(Fields!AGE.Value), "Blank", iif(CSTR(Fields!AGE.Value)= "", "Blank", CStr(Fields!AGE.Value) 

Here's what I tried to sort and can't get it to work..probably because to empty string is messing me up. I'm only showing a sample below otherwise the code would be too long.

=Switch(Fields!Age.value="INCORRECT", 1, Fields!Age.value= "AO", 2,true,3)

Thanks in advance for your help!


Solution

  • @rajeshpanchal - thanks for pointing me in the right direction. I went back and changed my SQL query to include the empty strings within the Case statement. Something like Case when fieldname = '10' and fieldname = '' then 'Blank Profile'

    Once I had the empty string named to something other than '1', then I was able to sort my chart within SSRS by creating a new calculated field and using the following Switch function:

    =Switch(Fields!Age.value="INCORRECT", 1, Fields!Age.value= "AO", 2,true,3)
    

    I then went to the chart data, right clicked on the category group and choose category group properties..then clicked on sorting and input my newly created sorting field. I was trying to get the INCORRECT bar to show first on the chart and you can see below that it worked.

    enter image description here