Following the post on dynamic topcount/toppercentage (see here ) I am looking for an additional row of information showing the % of the Top X in relation to the Total.
So, something like
create dynamic set [Top 5] as
topcount( [Etablissement].[Etablissement].[Etablissement].members, 5, [Measures].[Nbsejours])
*** End script ***
WITH
CATEGORY HIERARCHY [Stats].[Top], DEFAULT_MEMBER_NAME = "All Etabs"
CATEGORY MEMBER [Stats].[Top].[All Etabs].[Top 5 Etablissements] as
[Top 5],ADD_CHILDREN=true
CATEGORY MEMBER [Stats].[Top].[All Etabs].[Autres Etablissements (>5)] as
SubCubeComplement([Top 5]),ADD_CHILDREN=false
/* This is what I try, but it does not work */
CATEGORY MEMBER [Stats].[Top].[All Etabs].[Top 5 is % of total] as
[Top 5]/ [Etablissement].[Etablissement].[Etablissement].members, ADD_CHILDREN=false
SELECT
{[Measures].[NbSejours]} on 0,
{ [Stats].[Top].[Top 5 Etablissements],
[Stats].[Top].[Autres Etablissements (>5)],
[Stats].[Top].[Top 5 is % of total] } on 1
From [Cube]
Unfortunately, I get the error "the tuple expression did not generate a set of tuples or a sub-cube (numeric)."
Is such a thing possible, and how?
The suggestion in the comments above to add a calculated member in another 'not used' dimension worked:
WITH
CATEGORY HIERARCHY [Stats].[Top], DEFAULT_MEMBER_NAME = "All Etabs"
CATEGORY MEMBER [Stats].[Top].[All Etabs].[Top 5 Etablissements] as
[Top 5],ADD_CHILDREN=true
CATEGORY MEMBER [Stats].[Top].[All Etabs].[Autres Etablissements (>5)] as
SubCubeComplement([Top 5]),ADD_CHILDREN=false
/* the hierarchy [Stats].[stats] exists, I add a new calculated member
to it */
CALCULATED MEMBER [Stats].[Stats].[Top 5 is % of total] as
[Stats].[Top],[Stats].[Top].[All Etabs]
SELECT
{[Measures].[NbSejours]} on 0,
{([Stats].[Stats].[default] /* the default member */}* { [Stats].[Top].[Top 5 Etablissements],
[Stats].[Top].[Autres Etablissements (>5)],
[Stats].[Top].[Top 5 is % of total] })
+({[Stats].[Stats].[Top 5 is % of total]} * {[Stats].[Top],[Stats].[Top].[All Etabs]}) on 1
From [Cube]
The only drawback is that I now get a column in addition.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.