I want to create a metric which will show only the top 10 result whenever applied. Suppose the data is
item Price
A 20
B 45
C 50
D 80
E 10
F 90
G 85
H 55
I 40
J 100
I want to show the top 5 result in descending order. So, the expected result is:
j-100
f-90
g-85
d-80
h-55
other-165
I am already getting the result with the following MDX query:
With
Set [Top10] AS
(TOPCOUNT({ORDER( ({[DimProduct].[item].[All].Children})
,([Measures].[Price]),BDESC)},10))
MEMBER [DimProduct].[item].[OtherAll] AS
(avg({EXCEPT([DimProduct].[item].Members, [Top10])})
)
Select
[Measures].[ Price] on Columns,
{
[Top10]
,[DimProduct].[item].[OtherAll]
} on Rows
FROM [testcube]
Result:
j-100
f-90
g-85
d-80
h-55
other-165
I basically want to create a metric with the above query and save it to my cube solution.
So, when I drag item and price it will show all the data i.e all 10 rows.
A 20
B 45
C 50
D 80
E 10
F 90
G 85
H 55
I 40
J 100
And, when we drag our newly created metric then it will show top 5 result with the other row (other will be sum of rest of the rows)
j-100
f-90
g-85
d-80
h-55
other-165
Is there any way to achieve this functionality?
Edit 1
Created one dynamic set with top 10
Created calculated measure for others
Created another dynamic set to show both the results i.e top 10 and others.
But when we select the dynamic set to show top 10 + others, it is throwing the error:
A set has been encountered that can not contain calculated members