Percentage in SSRS on Total Value

  • Hi All,

    I have an SSRS reports that uses a Tablix to display the name of staff and the number of hours they have worked on a project. Below would be a sample of the report:

    Name Hours

    Staff 1 20

    Staff 1 40

    Staff 1 10

    Staff 2 20

    Staff 2 10

    ------------------

    Total 100

    Now I would like to add 1 more column to show the percentage (%) of time spent at the project for the employee on total hours on the project. So the report will be as below:

    Name Hours Time(%)

    Staff 1 20 20%

    Staff 1 40 40%

    Staff 1 10 10%

    Staff 2 20 20%

    Staff 2 10 10%

    ---------------------------

    Total 100 100%

    ---------------------------

    Is this possible to be created in SSRS as this is really required. If not is there any thing I can do on the DB or data set to show the time %.

    I am very new to SSRS so kindly help me to sort this out.

    Thanks & Regards,

    Dinendra

  • Hi Dolai,

    u can add a calculated field in the dataset for calculating the Percentage and create an expression to calculate the percentage

    Regards,

    Bhaskar

  • Can you be more specific?

  • Hi,

    use below function,

    to create this function click on Report menu Report Properties and Code tab,

    add below code.

    Public Function CalcRatio(ByVal Numerator As Object, ByVal Denominator As object, ByVal DivZeroDefault As Object) As Object

    If Denominator <> 0 Then

    Return Numerator/Denominator

    Else

    Return DivZeroDefault

    End If

    End Function

    now, wherever you want to show percentage call this function usin expression, pass appropiate parameters, one more thing Format Properties - 0.00%.

    Done 🙂

  • Hi,

    you can do some thing like this

    = Fields!Hours.Value/Sum(Fields!Hours.Value)

    Keep your textbox format as percent .

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

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