dbTalk Databases Forums  

Create Calculated Member In A Dimension SQL Server 2005

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Create Calculated Member In A Dimension SQL Server 2005 in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bryanlabutta@gmail.com
 
Posts: n/a

Default Create Calculated Member In A Dimension SQL Server 2005 - 12-21-2005 , 10:50 AM






I have a basic question about creating a calculated member in a
dimension while using SSAS 2005. I am working on a sales reporting
system and we would like to have one dimension member that denotes the
type of sale (sale, employee sale, return, employee return, etc.)
Right now the sale type can only be known by looking at multiple flags
in the Transaction Type and Return Info dimensions. So the goal of the
calculated member is to reduce this to just one flag that denotes the
sale type and encapsulate all of the logic to determine the sale type
within the calculated member.

I created a calculated member named [TRANSACTION TYPE] and entered the
expression MDX code, which is nothing more than a CASE statement that
includes the logic to determine the sale type. The dimension I would
like it to go under is named, for the moment, "TRD D TRAN FLAG." When
I selected the Parent Hierarchy, I selected, "TRD D TRAN FLAG.TRD D
TRAN FLAG." I cannot choose a parent member since it is a one-level
hierarchy. I saved the calculated member and reprocessed both the cube
as well as the TRD D TRAN FLAG dimension. However, when I go out to
the cube browser I cannot see my new calculated member and therefore
cannot do any testing with it.

One other note...when I create a calculated measure and put it in one
of my measure groups it shows up just fine and I can use it.

Am I doing something wrong or am I missing a step to have the
calculated member show up in the dimension?

Below is the MDX script for the calculated member...

Thanks, in advance,

Bryan

CREATE MEMBER CURRENTCUBE.[TRD D TRAN FLAG].[TRD D TRAN
FLAG].[TRANSACTION TYPE]
AS CASE
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[NO] AND
[TRD D TRAN FLAG].[Is Exchange].&[NO] AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[NO])
THEN "Sale"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[NO] AND
[TRD D TRAN FLAG].[Is Exchange].&[NO] AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[YES])
THEN "Employee Sale"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[NO] AND
[TRD D TRAN FLAG].[Is Exchange].&[YES] AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[NO])
THEN "Exchange"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[NO] AND
[TRD D TRAN FLAG].[Is Exchange].&[YES] AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[YES])
THEN "Employee Exchange"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[YES] AND
[TRD D TRAN FLAG].[Is Spa].&[NO] AND
([TRD D RETURN INFO].[Ret Receipt Idnt].&[2] OR
[TRD D RETURN INFO].[Ret Receipt Idnt].&[3]) AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[NO])
THEN "Catalog Return"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[YES] AND
[TRD D TRAN FLAG].[Is Spa].&[NO] AND
([TRD D RETURN INFO].[Ret Receipt Idnt].&[2] OR
[TRD D RETURN INFO].[Ret Receipt Idnt].&[3]) AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[YES])
THEN "Employee Catalog Return"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[YES] AND
[TRD D TRAN FLAG].[Is Spa].&[NO] AND
((NOT[TRD D RETURN INFO].[Ret Receipt Idnt].&[2]) AND
(NOT[TRD D RETURN INFO].[Ret Receipt Idnt].&[3])) AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[NO])
THEN "Store Return"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[YES] AND
[TRD D TRAN FLAG].[Is Spa].&[NO] AND
((NOT[TRD D RETURN INFO].[Ret Receipt Idnt].&[2]) AND
(NOT[TRD D RETURN INFO].[Ret Receipt Idnt].&[3])) AND
[TRD D TRAN FLAG].[Is Employee Transaction].&[YES])
THEN "Employee Store Return"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[YES] AND
[TRD D TRAN FLAG].[Is Spa].&[YES] AND
([TRD D RETURN INFO].[Ret Receipt Idnt].&[2] OR
[TRD D RETURN INFO].[Ret Receipt Idnt].&[3]))
THEN "Store SPA"
WHEN
([TRD D TRAN FLAG].[Is Return Transaction].&[YES] AND
[TRD D TRAN FLAG].[Is Spa].&[YES] AND
((NOT[TRD D RETURN INFO].[Ret Receipt Idnt].&[2]) AND
(NOT[TRD D RETURN INFO].[Ret Receipt Idnt].&[3])))
THEN "Catalog SPA"
END,
VISIBLE = 1;


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.