0

I have a 100% Stacked Bar chart. Students are banded based on their attendance,and the report simply tracks changes in the band populations as a percentage of the total student population. In Report Builder, this works totally fine (except in that it highlights our rubbish attendance of course...)

Image showing chart working fine in Report Builder

The problem arises when:

  1. The report is exported from Report Builder to PDF/Word/Excel/whatever
  2. The report is deployed to an SSRS server and run through the browser
  3. You change to a subsequent page of the report, and then change back to the page with the graph.

In all case although the actual chart remains unchanged, the Legend loses its mind a little bit and shows the top three items as 100%:

Broken when exported or deployed

I can't think of any reason that that should happen...the report was particularly finicky to make as a result of the underlying data structure (which regrettably is based on a Report Model, meaning I can't tweak it with SQL) and I had to use custom vb code in the end to get it to do what I wanted, but I can't see why any of that should change its behaviour either on the server or when exported.

So my question is; why does this happen, and how do I stop it happening?

EDIT: By Request:

The dataset inherently returns data in the format below. There's a row per learner ID per "Week Start Date".

Data format

The custom code I am using is pasted below (inept I know - no laughing!):

Private attendance_table As New System.Collections.Hashtable()
Private last_added_table As New System.Collections.Hashtable()

Public Function band_calc(ByVal attendance As Double) As String
    REM Define the bands that I want to track
    If attendance = 1 Then
        Return "A"
    ElseIf attendance >= 0.975 Then
        Return "B"
    ElseIf attendance >= 0.95 Then
        Return "C"
    ElseIf attendance >=  0.925 Then
        Return "D"
    ElseIf attendance >= 0.90 Then
        Return "E"
    ElseIf attendance >= 0.85 Then
        Return "F"
    ElseIf attendance >= 0.8 Then
        Return "G"
    Else
        Return "X"
    End If

End Function

Public Function get_attendance_band(ByVal week_start_date as String, ByVal learnerID As Integer, ByVal possibles As Integer, ByVal presents As Integer) As String


    If attendance_table Is Nothing Then 
        Dim attendance_table As New System.Collections.Hashtable()
    End If

    If last_added_table Is Nothing Then
        Dim last_added_table As New System.Collections.Hashtable()
    End If

    REM check if attendance_table has the Learner already
    If attendance_table.ContainsKey(learnerID) Then
        REM check if we've already added this week's data in
        If attendance_table(learnerID).ContainsKey(week_start_date) Then
            REM just return the band_calc for those data
            Return band_calc(attendance_table(learnerID)(week_start_date)(1) / attendance_table(learnerID)(week_start_date)(0))
        Else
            REM Add in this week to the hashtable. Add this weeks data to the last weeks data
            attendance_table(learnerID).Add(week_start_date, New Object() { possibles + attendance_table(learnerID)(last_added_table(learnerID))(0), presents + attendance_table(learnerID)(last_added_table(learnerID))(1)})

            REM record that this is now the last date updated for this learner
            last_added_table(learnerID) = week_start_date

            REM show the band!
            Return band_calc(attendance_table(learnerID)(week_start_date)(1) / attendance_table(learnerID)(week_start_date)(0))

        End If

    Else    
        attendance_table.Add(learnerID, New System.Collections.Hashtable())
        attendance_table(learnerID).Add(week_start_date, New Object() {possibles, presents})
        last_added_table.Add(learnerID, week_start_date)

        Return band_calc(attendance_table(learnerID)(week_start_date)(1) / attendance_table(learnerID)(week_start_date)(0))

    End If

End Function

For the series properties; The sort, group and label (which defines the Legend obviously) are all set to this:

series properties

Dan Scally
  • 1,922
  • 1
  • 19
  • 31
  • I think we will need more details to figure out what's wrong here. If you could include a small sample of data that this happens with along with the custom code, that would help. – StevenWhite Feb 22 '17 at 17:32
  • Thanks for the response. I'll add in an example of the data and the custom code I'm using. – Dan Scally Feb 23 '17 at 07:54
  • Can you include the series group properties please? Also, any other images that show the set up of the chart? – BishNaboB Feb 23 '17 at 08:30
  • @DanScally Next, add that expression to a table so you can see all the results. Compare it in preview vs. on the server to see if the calculations are really coming out different. That way we can determine if the issue is with the chart or the code. – StevenWhite Feb 23 '17 at 17:35
  • Hi Steven. I have tried that yeah - I dumped it all to excel and manually calculated the bands - the code calculates them correctly – Dan Scally Feb 23 '17 at 17:43

0 Answers0