Monday, March 28, 2011

Reporting services: Total and percentages for each row

I want a result to look like this (converting from a solution in Excel to reporting services):

Campaigns      Success      Not Success      Total      Success %     Not sucess %
Campaign 1     1            4                5          20%           80%
Campaign 2     4            4                8          50%           50%

How do I accomplish this task? I can add the Total column, without any problems - but i dont know how to add the sucess % and not success % columns :/

Thanks a bunch in advance! :)

/Jesper

From stackoverflow
  • I think to add new columns you just need to right click and add a new column?

    For the "detail" field of the Success % column, right click and selct "expression" to get to the expression editor. Then enter the following expression

    =(Fields!Success.Value/Fields!Total.Value) * 100

    For the Not sucess column do similar except your expression would be =(Fields!NotSuccess.Value/Fields!Total.Vlaue) * 100

    (obviously the names of the actual database fields may be different in your situation)

  • To add to Calanus's answer, you can format the cell to show a percent via its Right-Click Properties or by using the FORMAT function.

    =FORMAT((Fields!Success.Value/Fields!Total.Value), "P")
    =FORMAT((Fields!NotSuccess.Value/Fields!Total.Vlaue), "P")
    
    Nathan : Or you can highlight the cell in the designer and add a "p" in the Format property in the Properties window.
  • If you are using a matrix then you can use the group to divide by either column or row

    Ie.

    =round((Fields!count.Value/sum(Fields!count.Value,"matrix1_RowGroup1") * 100,2) & " %"

    the field count would be the total of any given category

    Example of record set

    CAMPAIGN COUNT TYPE

    Campaing1 1 Success

    Campaing1 4 Not Success

    Campaing2 4 Success

    Campaing2 4 Not Success

0 comments:

Post a Comment