Market Share Calculation in MDX based on AXIS

Below is the MDX which will calculate market share at runtime/dynamically. It always reads data from the parent axis.

iif
 (
  Axis(1)(0)(Axis(1)(0).Count – 1).Dimension.CurrentMember.Parent is null,
  null,
   (
     [measures].[x]
     /
     (
    [measures].[x],Axis(1)(0)(Axis(1)(0).Count -1).Dimension.CurrentMember.Parent
   )
  )
 
  * 100
 )

Advertisements

About Zahid

Team Lead at IMS Health (www.imshealth.com). A part-time consultant and trainer. Fields of expertise are ETL, BI Reporting (Microstrategy, Excel, ASP.NET Dashboards etc.) Data Warehouse, OLAP Cube, MDX etc.
This entry was posted in MDX, SSAS (Analysis Service), Cube. Bookmark the permalink.

2 Responses to Market Share Calculation in MDX based on AXIS

  1. Very nice but I have other problem.
    How I can show the Grand Total with sum of Market Share?

  2. Zahid says:

    Did u try writing a SCOPE for ‘ALL’ member of your parent dimension. You can sum over the Market Share calculated measure inside that SCOPE.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s