Question

enter image description hereI want to calculate percentage of individual Categories, Here is my mdx code.

WITH
MEMBER [Measures].[Individual_Total] AS ([DIM RATING STRINGS].[LABEL]*[Measures].AGG_RATING Count])

 SELECT
  NONEMPTY { 
   [Measures].[AGG_RATING Count],[Measures].[Individual_Total]
      } ONColumns,

  ([DIM STRUCTURE].[PARENT CODE].&[M01]&[M]:[DIM STRUCTURE].[PARENT CODE].&[M11]&[M],
  [DIM TAILORING].[TAILORING_LABEL].[TAILORING_LABEL],
  {[DIM RATING STRINGS].[LABEL].[LABEL],[DIM RATING STRINGS].[LABEL]}

  ) onrows


 FROM [Cube] 

Here is the output

In this output we have 4 categories like ""External Drivers ,stretegy,Business operation and governance.

I need to calculate percentage of different color with in the same category. For example if we take "External Drivers" then Calculation should be like
amber = 15/28 * 100, green = 5/28/*100 etc because 28 is the sum of external drivers. Please tell me how to do this thing in mdx.

thanks

Was it helpful?

Solution

Here you can compare with my solution, it will give you the percent of the parent.

with 
member [Measures].[Percent of parent] as
([Measures].[Order Quantity]) /
([Product].[Product Categories].currentmember.parent,
[Measures].[Order Quantity])
,format_string = "percent"

SELECT
{([Measures].[Order Quantity]),
([Measures].[Percent of parent])} ON COLUMNS,
{[Product].[Product Categories].[Category].&[3]} *
{[Product].[Subcategory].[Subcategory].Members} *
{[Product].[Style].[Style].Members} *
{[Product].[Product].members}
ON ROWS
FROM [Cube]

Results

I don´t know if i read your dimensions correctly but maybe your member should look something like:

with member [Measures].[Percent] as
 [Measures].[AGG_RATING Count] /
 ([DIM RATING STRINGS].[LABEL].CURRENTMEMBER.PARENT,
  [Measures].[AGG_RATING Count])
 , format_string = "percent"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top