0
votes

I need to apply interactive soring for matrix columns, which contain aggregated data.

The report is counting products sold in different places:

                 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

After descending sorting on "Product A" the table rows should be sorted by "Product A" sales in country, and also by sales in city:

                 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

The matrix scheme looks like this:

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

1 Answers

1
votes

Interactive sort is not supported in matrix.

A workaround could be the one below:

Create a sort by parameter with the values:

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

Then in the country create two sorting expressions:

    =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

Do the same for city:

    =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