I have a scenario where a result set has to be bucketed and assign a frequency.
For example, the following MDX query:
WITH MEMBER [MEASURES].[PERC_1] AS
AGGREGATE ( EXISTING [DIM CUSTOMER].[CUSTOMER ID].[ALL].CHILDREN,[MEASURES].[AMOUNT])
SELECT
[MEASURES].[PERC_1] ON 0,
[DIM CUSTOMER].[CUSTOMER ID].CHILDREN,[DIM CUSTOMER].[NAME].CHILDREN
FROM [ANALYSIS DW]
WHERE ([DIM CUSTOMER].[ADDRESS].[ALL])
should return this result:
Perc1
C1 10
C2 0
C3 20
C4 30
C5 40
C6 50
C7 50
C8 50
C9 90
C10 100
Now, I want this result set to be divided into buckets. If my bucket size is 3, the buckets should be
- 0-30
- 31-60
- 61-100
These buckets are calculated based on the maximum and minimum values of the perc_1 measure above; i.e., 0 is minimum and 100 is maximum. Buckets are calculated as (0+100)/3 -- (0-30, 31-60, 61-100).
Now the results after the frequency distribution on the above result set should look as below -
frequency
0-30 4
31-60 4
61-100 2
I will not get the access to the OLTP design/SSAS Cube solution.
I do not think you can do this completely within MDX in a way that the "3" is a parameter to the MDX query, as you need at least to have something like the member definitions for the buckets explicitly in the MDX statement. The WITH clause (or a session level CREATE statement) is the only place where you can create the members shown on the row axis, even if they are just used as placeholders and do not contain any logic.
You would need an external tool to generate a parameter specific MDX statement like that above.