Solved

MDX Expression for a Cube

Posted on 2012-04-10
2
479 Views
Last Modified: 2012-04-26
I have a fact table with the following structure:
DateID
BuyerID
SellerID
Amount

Both BuyerID and SellerID are UserID, meaning a user can be both a Buyer and a Seller.  Moreover, a Buyer can sell something to himself.  In this case, BuyerID and SellerID are the same.

Now this structure has been converted to a cube.  I want to create an Calculation member to show the total Amount of sales of a single user.  This amount should NOT include those Amount Sales that has the same BuyerID and SellerID (whatever the user sells to himself shouldn't be counted into the Total Amount of sales of the user).

How can I create this Calculation member?  Thanks.
0
Comment
Question by:thomaszhwang
2 Comments
 
LVL 15

Accepted Solution

by:
Tim Humphries earned 500 total points
ID: 37831958
Hi,

It would help if you posted the structures of the user hierarchies you have created. In the absence of these I will make some assumptions:

As you have User id acting in two roles I'll assume that you have hierarchies similar to:

[User].[Seller] and
[User].[Buyer] related to the fact table

I'll take the Amount as being [Measures].[Sales Amount]

As you want the Sales, then I'll assume that in your query you have [User].[Seller].Members on rows - this is important as we need to know  the Seller.Currentmember

You should then be able to use a calculation similar to:

MEMBER [Measures].[Seller Only Amount] As [Measures].[Sales Amount] - ([Measures].[Sales Amount], LINKMEMBER([User].[Seller].CURRENTMEMBER, [User].[Buyer]))

This should find the sales associated with the user as a buyer in the current tuple where the user is the seller i.e. where the user is both buyer and seller.


Tim
0
 

Author Closing Comment

by:thomaszhwang
ID: 37900437
Thanks.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question