Solved

MDX Expression for a Cube

Posted on 2012-04-10
2
472 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now