I'd like to add a new measure to my cube which is based upon values of an attribute. For example I'd like the measures to always apply the filter [Geography].[Country].&[Australia] applied even if the Geography attribute isn't included in the SELECT.
I've tried:
CREATEMEMBERCURRENTCUBE.[measures].[Oz Internet]
AS
AGGREGATE
(
EXISTING
(
{
[Geography].[Country].&[Australia]
}
*
[Sales Channel].[Sales Channel].&[Internet]
)
),
but this doesn't return anything. Is there a way to do this?
Here is an example where I limit a specific measure by a dimension member:
Code Snippet
withmember [Measures].[Reseller Sales Amount Bikes] as
([Measures].[Reseller Sales Amount],[Product].[Category].[Bikes])
select
{[Measures].[Reseller Sales Amount],[Measures].[Reseller Sales Amount Bikes]} on 0,
[Date].[Calendar].[Month].Memberson 1
from [Adventure Works]
Bryan|||Thanks for that. What if I needed it to work for more than one category eg Bikes and Accessories? I'm sure it's going to be simple but I can't get the syntax right.|||One way to pull out the individual measure values and add them. That's seen in the first calculated member.
In the next calculated member, you can see I build a set of members, get the measure against this set and then aggregate. You can build that first set many different ways.
Good luck,
Bryan
Code Snippet
withmember [Measures].[Reseller Sales Amount Bikes+] as
([Measures].[Reseller Sales Amount],[Product].[Category].[Bikes])+
([Measures].[Reseller Sales Amount],[Product].[Category].[Accessories])
member [Measures].[Reseller Sales Amount Bikes+ Too] as
AGGREGATE({[Product].[Category].[Bikes],[Product].[Category].[Accessories]},[Measures].[Reseller Sales Amount])
select
{[Measures].[Reseller Sales Amount],
[Measures].[Reseller Sales Amount Bikes+],
[Measures].[Reseller Sales Amount Bikes+ Too]} on 0,
[Date].[Calendar].[Month].Memberson 1
from [Adventure Works]
|||That's very helpful. Thanks Bryan.
Mark
No comments:
Post a Comment