Im trying to make a calculated member that contains a different calculation depending on a value of an attribute.
something like: "CASE WHEN Attribute X = "string A" THEN calculation X ELSE calculation Z" I tried the IFF and the CASE statement, but with negative results
Any Suggestions?
I am using MS AS 2005 RTM.A more efficient way to achieve this in AS 2005 (assuming that AttributeHierarchyEnabled is set to True for Attribute X) is to scope the calculation in the cube MDX Script on Attribute X. This Newsgroup thread explains how, in a similar situation:
http://groups.google.com/group/microsoft.public.sqlserver.olap/msg/3f05cf53d0cf9f06
>>
Newsgroups: microsoft.public.sqlserver.olap From:"Chris Webb"
Am I right in thinking that Guest Factor is also an attribute on your
Customer dimension? If it isn't, it probably should be. If it is, then
instead of scoping on all customers and testing whether they have Guest
Factor=1, you should scope on the Guest Factor attribute directly. The script
would end up looking something like this:
CALCULATE;
SCOPE ([Measures].);
SCOPE ([PRODUCT].[PRODUCT].&[2]);
SCOPE([CUSTOMER].[CUSTOMER].members, [CUSTOMER].[Guest
Factor].&[1]);
THIS =
([PRODUCT].[PRODUCT].&[1])
* ( [CUSTOMER].[CUSTOMER].&[ADULTS])
/ ( [CUSTOMER].[CUSTOMER].&[ADULTS], [PRODUCT].[PRODUCT].&[1]
)
END SCOPE;
END SCOPE;
END SCOPE;
As I understand it, by getting rid of the CASE statement and scoping
directly on the area of the cube you want the calculation will be much faster
- there'll be no checking whether Guest Factor=1 happening at runtime.
>>
No comments:
Post a Comment