SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


MDX Newbie: How to combine some members to create a new member at same level (but not a calc....


MDX Newbie: How to combine some members to create a new member at same level (but not a calc. member)

Author
Message
tim-1151818
tim-1151818
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 6
I have a Dimension Items with first level ItemType.
I want to create a member which combines some of the existing members.
For example, I have members [Items].[ItemType].Deposit and [Items].[ItemType].GiftVouchers
and I want to "pretend" that I actually have a member [Items].[ItemType].DepositsAndVouchers

It sounds like Aggregate would do what I want:

With
Member [Items].[ItemType].[DepositsAndVouchers] as '
Aggregate({[Items].[ItemType].[Deposit], [Items].[ItemType].[GiftVouchers]})'
select [Items].[ItemType].[DepositsAndVouchers] on columns,
[Measures].[AmtReceived] on rows



Logically I thought this would work ... but I get nothing (using Mondrian actually)
So I have a conceptual problem with how MDX works, perhaps.
stevefromOZ
stevefromOZ
SSCrazy Eights
SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)

Group: Moderators
Points: 9972 Visits: 3757
Aggregate only works on measures. Take the aggregate function out of your calc member definition and simply make a new member that is (A , B) then refernece that member on rows of columns with a measure.

HTH,

Steve.
tim-1151818
tim-1151818
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 6
But I can't use a set to define a member ... I have to have some function.
So doing this
with Member [Items].[ItemType].[DepositsAndVouchers] as '{[Items].[ItemType].[Deposit],[Items].[ItemType].[GiftVouchers]}'

give an error
stevefromOZ
stevefromOZ
SSCrazy Eights
SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)

Group: Moderators
Points: 9972 Visits: 3757
Yep, I misread what you are doing. So when you select just those two members on rows with the same measure, they return values but when you use them in the calc member, it doesn't?

Steve.
tim-1151818
tim-1151818
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 6
stevefromOZ (7/20/2013)
Yep, I misread what you are doing. So when you select just those two members on rows with the same measure, they return values but when you use them in the calc member, it doesn't?


Yes, when I use the two members on rows, I get the total of sales for each of those two members.
When I use aggregate, I get no output for that member.

I thought this would have been a common requirement: to simulate new members that are the sum of siblings.
tim-1151818
tim-1151818
SSC-Enthusiastic
SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)SSC-Enthusiastic (102 reputation)

Group: General Forum Members
Points: 102 Visits: 6
My problem is that I do not understand how to write member names. I am confused about when you need to use [Dimension].[Level].[Member] and when [Dimension].[Member] is correct.

I used a demo cube and got it to work.
In this cube, there is a dimension Department with a single level also called Department.

This query does what I want: it creates a new member SF which adds the two real members (Sales and Finance). So I need to learn about how to write member names in multi-level hierarchies.


with member [Department].SF as
[Department].Sales + [Department].Finance
SELECT {[Department].[Sales], [Department].[SF]} on columns,
[Measures].[Actual] on rows

FROM [Quadrant Analysis]
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search