0
votes

We have a cube that it has one measure (Commission Amount) and two dimensions customer and Date. I want calculate ratio of (count of customers who create 80 percent of Commission Amount) to (count of total customer) It is important to say that customers are sorted base on their Commission Amount How can solve this problem? And what must use to solve this query?

2
what environment are you in when writing the mdx ? ssrs, modrian ?whytheq

2 Answers

0
votes

You want to use the TopPercent() function here:

TopPercent(
    existing [Customer].[Customer].[Customer].Members, 
    80,  
    [Measures].[Commission Amount]  
)
/
existing [Customer].[Customer].[Customer].Members.Count
0
votes

Basically the same approach as Danylo - I just added an extra COUNT and deleted some, possibly redundant, EXISTING keywords:

DIVIDE(
  COUNT(
    TOPPERCENT(
      {[Customer].[Customer].[Customer].MEMBERS}, 
      80,  
      [Measures].[Commission Amount]  
    )
  )
  ,[Customer].[Customer].[Customer].MEMBERS.COUNT
)