Getting SSRS Matrix Row Total for a Particular Column Value

妖精的绣舞 提交于 2019-12-06 08:22:44

问题


In Microsoft Sql Server Reporting Services 2008 R2 Matrix, I'd like to add a column that shows the percentage of one data item divided by the total count of that row's data items.

Total's expression is =Sum(Fields!Count.Value). How would I access the row's sum of Success from Success Percent so that I can do something like =SUM(Fields!Count.Value WHERE Fields!Name.Value = "Success")/SUM(Total)?

Adv.Name    Success         Failed  Total       Success Percent
A           2               8       10          20%
B           10              0       10          100%
C           8               2       10          80%
            ----------------------
            Data Items
                                    -----------
                                    Column Grp Total

Thank you!


回答1:


Ah! This is rather easy! Aparently, the experession inside SUM is executed once per data item, allowing me to use a standard Iif statement to do the necessary filtering.

=SUM(Iif(Fields!Status.Value = "Success", Fields!Count.Value, 0))/SUM(Fields!Count.Value)


来源:https://stackoverflow.com/questions/12203597/getting-ssrs-matrix-row-total-for-a-particular-column-value

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