Wednesday, March 7, 2012

Defining a named set

I have built a cube and I want to add a named set. Following dimensions are important: suscriber and handset. The set I want to create should contain only those subscribers for which the handset is different from the handset from the month before.

I tried to use the filter function resulting in the following:

filter([Dim Subscriber].[Subscriber].[Subscriber].members,([Time].[Month],[Dim Handset].[Dim Handset].[Dim Handset])<>([Time].[Month].prevmember,[Dim Handset].[Dim Handset].[Dim Handset]))

But deploying the cube returns the error message that "<>" cannot be used with sets...

Can anybody help me? Thanks in advance...

Regards

Joos

Use MemberValue for handset

(See help at ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/mdxref9/html/f9b2af16-2b81-48e4-ae81-99f64e4bbc98.htm in Books online).

|||

But then I have to define a specific handset member. I want only those subscribers for which the handset in the current month is different from the month before. Maybe I do have to use the measure base, which simply counts all subscribers?

filter([Dim Subscriber].[Subscriber].[Subscriber].members,([Time].[Month],[Dim Handset].[Dim Handset].[Dim Handset],[Measures].[Base])<>([Time].[Month].prevmember,[Dim Handset].[Dim Handset].[Dim Handset],[Measures].[Base]))

But this returns the error: Error 1 The '<>' operator cannot be used with sets.

|||

You mentioned that [Dim Subscriber] and [Dim Handset] dimensions are important, but didn't describe the fact table data. Anyway, assuming that there are only fact records in a given month for valid combinations of Subscriber and Handset, it's still not clear how you define the current month. So, assuming that the current month is the last in the [Time].[Month] hierarchy:

>>

Extract(Filter(NonEmpty([Dim Subscriber].[Subscriber].[Subscriber].Members

* [Dim Handset].[Handset].[Handset].Members * Tail([Time].[Month].[Month].Members),

{[Measures].[Base]}),

IsEmpty(([Measures].[Base], [Time].[Month].PrevMember))),

[Dim Subscriber].[Subscriber])

>>

No comments:

Post a Comment