The following does a "percent of parent", "percent of total" along the
Product Categories hierarchy in the Adventure Works DW database.
WITH MEMBER measures.pcntOfParent as ([Product].[Product
Categories].CurrentMember, Measures.[Internet Sales Amount])
/ (iif([Product].[Product Categories].CurrentMember.Parent is null
,[Product].[Product Categories].CurrentMember
,[Product].[Product Categories].CurrentMember.Parent),
Measures.[Internet Sales Amount]), FORMAT_STRING = "0.00%"
MEMBER measures.pcntOfTotal as ([Product].[Product
Categories].CurrentMember, Measures.[Internet Sales Amount])
/ ([Product].[Product Categories].[All Products], Measures.
[Internet Sales Amount]), FORMAT_STRING = "0.00%"
SELECT
{ Measures.[pcntOfParent], Measures.pcntOfTotal } ON COLUMNS
, {[Product].[Product Categories].Members} ON ROWS
FROM [Adventure Works]
Creating a "percent of displayed" measure is a lot more difficult to do
generically. You could look at the axis() function to try and figure out
what the users are querying, but it is easier to take the percentage
from a fixed point of reference.
--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell
In article <1150582359.533297.265910 (AT) g10g2000cwb (DOT) googlegroups.com>,
willrich33 (AT) yahoo (DOT) com says...
Quote:
Joe:
I actually need to know this stuff so I will pass it on...
I had some success with
sum(nonempty(EXISTING crossjoin([Commercial Cube].[Brand].members,
{[Measures].[Daily Weight]})))
in AS 2005....
I was using this stuff to calculate the market share by category...
ie Crest/Total Toothpaste
where I had many categories...
HTH, Willy
willy wrote:
Joe:
Maybe not...I tried this and got recursion..
iif(isleaf([Commercial Cube].[Brand].currentmember),
[Measures].[Daily Weight]/sum([Commercial Cube].[Brand].currentmember),
null)
You can look at the post.."Select Multiple - Infinite recusion
situation." I tried this syntax with a sum instead of count and got an
error...
Sorry I can't help more...I will follow your thread to see if anyone
has a better way...
Willy
Joe Murray wrote:
I am on SSAS 2005. There has to be an easier way?
"willy" wrote:
Joe:
I have assumed you are using AS2000, if you are on AS2005 I am not sure
how to proceed. |