简体   繁体   English

在SSRS报告中对分组的系列进行排序

[英]Sort grouped series in SSRS Report

I have a chart with a count of X per year per category, ie 我有一个图表,每个类别每年X的计数,即

X #####                       # 2012
X @@@@@@                      @ 2013
Y #############
Y @@
Z ###########
Z @@@@@@@@@@@@@@@@@

How can I apply a sort to the 2013 values (but keep the grouping within X, Y, Z) - ie in this case, Z at the top, X mid and Y at the bottom, based on 2013 values. 如何对2013年值进行排序(但将分组保持在X,Y,Z内)-即,在这种情况下,基于2013年值,Z在顶部,X在中间,Y在底部。

Ok, the trick is to name the Category Group and then use a sort expression on the Category Group. 好的,诀窍是命名类别组,然后在类别组上使用排序表达式。 If you want to sort by values in 2013, use 如果要按2013年的值排序,请使用

=Sum(IIf(year(Fields!TradeDate.Value) = 2013, 
    CDbl(Fields![The field being summed].Value), CDbl(0)), 
    "[The Category Grouping Name]")

The Cdbl is required to ensure Sum is working on the same data types. 需要Cdbl以确保Sum使用相同的数据类型。

我敢打赌,如果您按“年”和“按-XYZ是-”将行组添加到报表中,则可以按年对输出进行排序,同时保持xyz分组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM