I'm trying to write a mdx query that would calculate the income percentage for each product in 3 different columns, depending on the percentage "base" - the Group (that the product is in) income, the subgroup income and total income. So far this is my code
with
member [Measures].[Percent] as
([Measures].[Income]) /
([Products].[product].currentmember.parent,
[Measures].[Income])
,format_string = "percent"
select
{
[Measures].[Percent]
}
on columns,
{
[Products].[Product].[Product]
}
on rows
from [CUBE]
It calulates the percentage based on the total income, but I have no idea how to change the code to fill the criteria I mentioned earlier. I tried rearrenging the code many times in many different ways, (trying to calculate the sobgroup percentage example)
with
member [Measures].[Percent] as
([Measures].[Income], [Products].[Subgroup]) /
([Products].[product].currentmember.parent,
[Measures].[Income])
,format_string = "percent"
etc but I only get the same result or errors. I'm still very new to mdx so any help or tip would be much appreciated.
Hierarchy
?! You will need to use this hierarchy as your original script was hitting the attribute hierarchy called Towar (with the 6 little squares next to it) I changed my script. – whytheq