• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 687
  • Last Modified:

Calculated Member MDX Expression Syntax

I am trying to build a calculated member based on logic that depends on values for a given dimension attribute.  How would I go about building the expression?  For example if a given attribute value is 'A' then I want to count an existing measure towards this calculated member.  Any sample code would be helpful.
0
angupta
Asked:
angupta
  • 3
2 Solutions
 
Reza RadCommented:
you can use case expression for conditional expressions, look at here for example:
http://msdn.microsoft.com/en-us/library/ms722762%28v=VS.85%29.aspx

0
 
Reza RadCommented:
all types of mdx conditional expressions are here:
http://msdn.microsoft.com/en-us/library/ms711272%28VS.85%29.aspx
0
 
anguptaAuthor Commented:
These examples use measures only,  I need to use attribute values in the case statement.  I tried doing this before however I am unable to read in the values the attributes.
0
 
Reza RadCommented:
you can get values as below:
http://www.experts-exchange.com/Database/OLAP/Q_23057356.html

let me know if i am wrong in understanding your problem
0
 
Megan BrooksSQL Server ConsultantCommented:
Show us something you tried that didn't work, or elaborate on what you are trying to do. I ran a quick test with a query in this form and it worked just fine:

with member Measures.chooseone as case [Dim].[Hier] when [Dim].[Hier].&[1] then [Measures].[M1] when [Dim].[Hier].&[2] then [Measures].[M2] when [Dim].[Hier].&[3] then [Measures].[M3] end
select {measures.chooseone} on columns, [Dim].[Hier2].[Hier2] on rows from [Cube]
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now