Question

I've two kind of reports (send reports and receive reports), and two role-playing dimensions (senders and receivers). I'm trying to compare amounts from each reports for one organization by it's senders/receivers.

My current query is:

with member [Measures].[SentAmount] as ( [Receiver].[Code].&[XXX],[Measures].[Sent] )
member [Measures].[ReceivedAmount_Temp] as 
    (
        [Sender].[Code].&[XXX],
        [Measures].[Received]
    )
member [Measures].[ReceivedAmount] as
(
    LINKMEMBER
    (
        [Sender].[Code].CURRENTMEMBER,[Receiver].[Code]
    ),
    root([Sender]),
    [Measures].[ReceivedAmount_Temp]
)   
SELECT  
{ 
[Measures].[SentAmount],
[Measures].[ReceivedAmount]
} ON COLUMNS, 
NON EMPTY  
{ (
    [Sender].[Code].[Code].ALLMEMBERS
    *[Sender].[Name].[Name].ALLMEMBERS

)} FROM MyCube

Result is correct but execution time is very long. Especially on real query where I've 15-20 measures.

Is it possible to optimize this query in any way?

Was it helpful?

Solution

This is not a complete solution, but an approach: What about using a "role playing fact table": You would have two copies of the fact table, named, say "Sent" and "Received". Both would reference the same dimension "Customer" (from the Received fact table, as the receiver, and from the Sent fact table as the sender). The other party (the sender for the Received fact and the receiver from the Sent fact) would reference the customer table as well, this time with a role playing dimension.

Technically, you could implement this via views or named queries in the DSV, as the BIDS GUI does not allow to use one fact table for two measure groups.

The advantage would be that you do not need any calculated measures for your query, which are probably the main reason for the bad performance.

OTHER TIPS

Try to replace the root() function for an explicit [All] member. For a strange reason, root() worked very slow when I tried LinkedMember() function on my calculated measures.

Hope this helps you too!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top