Filtering results of an MDX query in a single row of a matrix based on externa(user/hard-coded)l parameter.
Hello,
I am trying to build an SSRS report from an Analysis Services cube using SQL Server 2008 R2. The output of the report should be as follows( example)
Items Sold
2004-05
2005-06
2006-07
2007-08
2008-09
2009-10
Item1
1,038
1,025
792
887
783
753
Item2
2,171
2,162
2,613
2,430
2,182
2,106
Item3
258
274
268
274
235
234
Item 4
423
401
491
396
451
479
Item 5
208
175
163
144
163
158
Total
4,098
4,037
4,327
4,131
3,814
3,730
Percentage of Item 4 sold compared to total
25%
25%
18%
21%
21%
20%
I have built a cube which can show this information .
Financial Year
2004-05
2005-06
2006-07
2007-08
2008-09
2009-10
Grand Total
Items
Percentage of Total
Items Sold
Percentage of Total
Items Sold
Percentage of Total
Items Sold
Percentage of Total
Items Sold
Percentage of Total
Items Sold
Percentage of Total
Items Sold
Percentage of Total
Items Sold
Item1
66.22%
18961
67.00%
19115
66.21%
18959
65.82%
19130
65.08%
18767
64.84%
18849
65.86%
113781
Item2
9.70%
2777
9.43%
2691
9.37%
2682
8.94%
2597
9.91%
2857
9.85%
2863
9.53%
16467
Item3
10.32%
2956
10.23%
2919
10.88%
3115
11.01%
3199
11.01%
3176
11.64%
3385
10.85%
18750
Item 4
4.35%
1245
4.16%
1186
3.20%
917
3.43%
998
3.10%
893
2.96%
860
3.53%
6099
Item 5
9.42%
2696
9.18%
2620
10.34%
2960
10.80%
3139
10.90%
3143
10.71%
3114
10.23%
17672
Grand Total
100.00%
28635
100.00%
28531
100.00%
28633
100.00%
29063
100.00%
28836
100.00%
29071
100.00%
172769
I created a Calculated Member function which can gets the % for all items as shown below.
Case
// Test to avoid division by zero.
When
IsEmpty
(
[Measures].[Items Sold]
)
Then
Null
Else
( [CubeName].[Items].currentmember,
[Measures].[Items Sold] )
/
(
// The Root function returns the (All) value for the target dimension.
Root
(
[CubeName].[Financial Year ]
),
[Measures].[Items Sold]
)
End
-----
My question is how can I configure the last row of the matrix report-item so that I can allow the user to select the" Item" for which the percentages would be displayed?
I know i can use a parameter to accept user input. However, I need to know how to get correct percentage value in the correct Financial Year column based on (say for e.g "Item 4" ) . I know that it is possible to filter the dataset assigned to the matrix
but it is not possible to do that at row/column level. So is there any workaround using expressions or other technique?
Thanks,
Ashish Sathe
February 16th, 2011 12:42am
Hi Ashish,
--My question is how can I configure the last row of the matrix report-item so that I can allow the user to select the" Item" for which the percentages would be displayed?
I would suggest you try to use Subreport to calculate the specific Item percentage in specific month. Then, on the main report, in the matrix cell, insert a SUBREPORT control to link the percentage from the subreport newly created with Item and Month
parameter mapping.
thanks,
Jerry
Free Windows Admin Tool Kit Click here and download it now
February 23rd, 2011 12:55am