Home > Archive > MS SQL Server OLAP > November 2005 > MDX to calculate ratio of two items in the same dimension.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MDX to calculate ratio of two items in the same dimension.
Mahesh Shrestha

2005-11-25, 8:23 pm

Hi,

This must be a common problem.

I need to calculate the ratio between two members of the same dimension
based on one measure. For example i need to find out the ratio of
[Measure].[sales] between [Product].[Honda] and [Product].[Toyota].

Ideally the output should be in this format:

Honda/Toyata - .75

Any help will be greatly appreciated.

Thanks
Mahesh

*** Sent via Developersdex http://www.droptable.com ***
Mahesh Shrestha

2005-11-25, 8:23 pm

Following MDX is working but giving me the integer division and decimal
part is not showing up. If the result is less than 1, it is showing
blank.

With Member [Product].[Ratio] As '[Product].[Honda]/[Product].[Toyota]'
Select {[Measure].[Sales]} on columns,
{[Product].[Ratio]} on rows
from.....



*** Sent via Developersdex http://www.droptable.com ***
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com