How to add totals to each group in SSRS

女生的网名这么多〃 提交于 2019-12-25 07:59:13

问题


I need to have a total for each grouping within a row group in SSRS. Currently, a total is added right at the end of the row group.

So, if I have the following data:

TeamName    BusinessSegment  PaymentPeriod  BusinessArea      ProductType        PolicyCount201501    Premium201501   
---------------------------  -------------  ----------------  ----------------   ------------------   --------------- 
Office      Non-property     Monthly        Commercial Lines  Sectional Title    0.00                 0.00            
Office1     Non-property     Annual         Commercial Lines  C&I Generic (Web   1.00                 24025.00        
Office1     Non-property     Annual         Commercial Lines  Property Protect   1.00                 24025.00       
Office1     Non-property     Monthly        Commercial Lines  BizzInsure         1.00                 24025.00      
Office1     Non-property     Monthly        Commercial Lines  Sectional Title    1.00                 24025.00       
Office2     Non-property     Annual         Commercial Lines  Property Protect   1.00                 24025.00        
Office2     Non-property     Annual         Commercial Lines  Sectional Title    1.00                 24025.00        
Office2     Non-property     Annual         Commercial Lines  Sectional Title    1.00                 24025.00        
Office2     Non-property     Monthly        Commercial Lines  M&F Commercial B   1.00                 24025.00        
Office2     Non-property     Monthly        Commercial Lines  Sectional Title    1.00                 24025.00  

I want the output to be like this:

Team Name       Business Segment    Payment Period  Business Area       Product Type    Policy Count 201501     Premium 201501
Office          Non-property        Monthly         Commercial Lines    Sectional Title 0.00                    0.00
                                                    Total                               0.00                    0.00
                                    Monthly Total                                       0.00                    0.00
                Non-property Total                                                      0.00                    0.00
Office Total                                                                            0.00                    0.00
Office1         Non-property        Annual          Commercial Lines    Something1      1.00                    1.00
Office1         Non-property        Annual          Commercial Lines    Something2      1.00                    1.00
                                                    Total                               2.00                    2.00
                                    Annual Total                                        2.00                    2.00
Office1         Non-property        Monthly         Commercial Lines    Something1      0.00                    1.00
Office1         Non-property        Monthly         Commercial Lines    Something2      1.00                    1.00
                                                    Total                               1.00                    2.00
                                    Monthly Total                                       1.00                    2.00
                Non-property Total                                                      3.00                    4.00
Office1 Total                                                                           3.00                    4.00
Office2         Non-property        Annual          Commercial Lines    Something1      0.00                    1.00
Office2         Non-property        Annual          Commercial Lines    Something2      1.00                    1.00
                                                    Total                               1.00                    2.00
                                    Annual Total                                        1.00                    2.00
Office2         Non-property        Monthly         Commercial Lines    Something1      2.00                    1.00
Office2         Non-property        Monthly         Commercial Lines    Something2      1.00                    1.00
                                                    Total                               3.00                    2.00
                                    Monthly Total                                       3.00                    2.00
                Non-property Total                                                      4.00                    4.00
Office2 Total                                                                           4.00                    4.00
Grand Total                                                                             7.00                    8.00

Note that PaymentPeriod is grouped by Monthly and Annually and there is a total after Monthly and a total after Annually. Currently, the following is rendered (Note the single Annual total at the end of each PaymentPeriod grouping:

Team Name       Business Segment    Payment Period  Business Area       Product Type    Policy Count 201501     Premium 201501
Office          Non-property        Monthly         Commercial Lines    Sectional Title 0.00                    0.00
                                                    Total                               0.00                    0.00
                                    Monthly Total                                       0.00                    0.00
                Non-property Total                                                      0.00                    0.00
Office Total                                                                            0.00                    0.00
Office1         Non-property        Annual          Commercial Lines    Something1      1.00                    1.00
Office1         Non-property        Annual          Commercial Lines    Something2      1.00                    1.00
                                                    Total                               2.00                    2.00
Office1         Non-property        Monthly         Commercial Lines    Something1      0.00                    1.00
Office1         Non-property        Monthly         Commercial Lines    Something2      1.00                    1.00
                                                    Total                               1.00                    2.00
                                    Annual Total                                        3.00                    4.00
                Non-property Total                                                      3.00                    4.00
Office1 Total                                                                           3.00                    4.00
Office2         Non-property        Annual          Commercial Lines    Something1      0.00                    1.00
Office2         Non-property        Annual          Commercial Lines    Something2      1.00                    1.00
                                                    Total                               1.00                    2.00
Office2         Non-property        Monthly         Commercial Lines    Something1      2.00                    1.00
Office2         Non-property        Monthly         Commercial Lines    Something2      1.00                    1.00
                                                    Total                               3.00                    2.00
                                    Annual Total                                        4.00                    4.00
                Non-property Total                                                      4.00                    4.00
Office2 Total                                                                           4.00                    4.00
Grand Total                                                                             7.00                    8.00

How would I achieve this please?


回答1:


Add another child group to your Payment Period group and add total to your second group. Delete the column from display for the first group (Do not delete the first group).

Output:



来源:https://stackoverflow.com/questions/40282715/how-to-add-totals-to-each-group-in-ssrs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!