SSRS sum max by group

前端 未结 2 500
耶瑟儿~
耶瑟儿~ 2021-01-12 05:09

I have an SSRS report that looks like this (with additional columns such as sales) with rows grouped by region and location.

相关标签:
2条回答
  • 2021-01-12 05:53

    Have you tried =Max(Fields!goal.Value) ? If you need the unscoped grand total this should work. Here is a great MSDN article on Adding Grouping and Totals. Below is an image taken from that article that shows how to set it up.

    enter image description here

    Renders:

    enter image description here

    0 讨论(0)
  • 2021-01-12 05:55

    In both of the total textboxes, region and Grand Total, you can use the same expression:

    =Sum(max(Fields!goal.Value, "LocationName"))
    

    Because the expression is calculated in the current Scope of the textbox, at the Region Group level this will be aggregating the Max goal value in all LocationName groups in the region, and at the Grand Total level this will be aggregating the Max goal value in all LocationName groups in all regions.

    You can see this in action. With data like:

    enter image description here

    (I've doubled up the rows to make it obvious if the end totals are correct)

    and a simple table:

    enter image description here

    The same expression gives the correct result in both the Region and Grand Total Scope:

    enter image description here

    0 讨论(0)
提交回复
热议问题