Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MDX Expression for a Cube

Posted on 2012-04-10
2
Medium Priority
?
487 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

972 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