Reporting Services:如何对矩阵列应用交互式排序?

时间:2011-08-30 15:53:26

标签: sorting reporting-services

我需要为包含聚合数据的矩阵列应用交互式分析。

该报告计算在不同地方销售的产品:

                 Product A          Product B         Product C
---------------------------------------------------------------
Country 1                5                 10                 4
  City A                 3                  0                 3
  City B                 2                 10                 1
---------------------------------------------------------------      
Country 2               10                  5                 5
  City C                 2                  4                 2
  City D                 8                  1                 3

在对“产品A”进行降序排序后,表格行应按国家/地区的“产品A”销售额进行排序,并按城市销售额进行排序:

                 Product A          Product B         Product C
---------------------------------------------------------------      
Country 2               10                  5                 5
  City D                 8                  1                 3
  City C                 2                  4                 2
---------------------------------------------------------------
Country 1                5                 10                 4
  City A                 3                  0                 3
  City B                 2                 10                 1

矩阵方案如下所示:

                   | [Product]
[Country] | [City] | [Count(Product)]

1 个答案:

答案 0 :(得分:1)

矩阵不支持交互式排序。

解决方法可能如下:

使用值创建按参数排序:

Label                   Value
Country ASC, City ASC     1
Country DESC, City ASC    2
Country ASC, City DESC    3
Country DESC, City DESC   4

然后在国家创建两个排序表达式:

    =Iif(Parameters!SortBy.Value = 1 OR Parameters!SortBy.Value = 3,Fields!country.Value,"")
ASCENDING sort
    =Iif(Parameters!SortBy.Value = 2 OR Parameters!SortBy.Value = 4,Fields!country.Value,"") 
DESCENDING sort

为城市做同样的事情:

    =Iif(Parameters!SortBy.Value = 1 OR Parameters!SortBy.Value = 2,Fields!city.Value,"")
ASCENDING sort
    =Iif(Parameters!SortBy.Value = 3 OR Parameters!SortBy.Value = 4,Fields!city.Value,"")
    DESCENDING sort