Median Values in SSRS

  • Hello Everyone,

    I have used the the following code to calculate the Median values for employee salary in SSRS.

    ***************************************

    Dim values As System.Collections.ArrayList

    Function AddValue(ByVal newValue As Decimal)

    If (values Is Nothing) Then

    values = New System.Collections.ArrayList()

    End If

    values.Add(newValue)

    End Function

    Function GetMedian() As Decimal

    Dim count As Integer = values.Count

    If (count > 0) Then

    values.Sort()

    GetMedian = values(count / 2)

    End If

    End Function

    **************************************

    The median values look fine in the development. However, after I deployed the report to the server and run the report in Internet Explore, all median values are showing up as 0.00. I do not get.

    Please help.

    Thanks

  • One way to get around this is to calculate the median before it get's to SSRS. For example, say you are getting your data from a SQL Server Stored Procedure you could calculate the median in the stored procedure.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • How to write a SQL query in SSRS expression?

    Something like = Select * from ...

    thanks

  • fliu2265 (10/26/2015)


    How to write a SQL query in SSRS expression?

    Something like = Select * from ...

    thanks

    You create a dataset, do your query there, then reference the value of the dataset in an expression.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply