Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Filtering MDX Dimension count

Posted on 2010-01-08
6
Medium Priority
?
1,306 Views
Last Modified: 2016-02-13
I'm using the code below to get the count of the children in a dimension.  How can I limit it so that I only get the children that match a specific criteria?  Adding WHERE [Date].[Year Number].&[2009] to the bottom just returns the total number of children, not the children with Year Number = 2009.

Thanks!
WITH  
MEMBER measures.X AS
  [Date].[Quarter].children.count
SELECT Measures.X ON 0
FROM [CubeName]

Open in new window

0
Comment
Question by:StacyThomas
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:srnar
ID: 26275382
you have to use Current member - I hope it will be working

WITH  
MEMBER measures.X AS
  [Date].[Quarter].CurrentMember.children.count
SELECT Measures.X ON 0
FROM [CubeName]


0
 

Author Comment

by:StacyThomas
ID: 26283330
Sorry, srnar, it's still not working.  I'm assuming that I need to put the WHERE clause at the end of your statement?
0
 
LVL 8

Expert Comment

by:srnar
ID: 26283420
Sorry, you have to put the Quarter attribute on separate axis. You are recommendet to quote also another measure, because the facts are the glue of dimensions.

WITH  MEMBER measures.X AS
  [Date].[Quarter].CurrentMember.children.count
SELECT
   {Measures.X, Measures.SomeRealMeasure} ON columns,
   [Date].[Quarter].CurrentMember ON rows
FROM [CubeName]
WHERE [Date].[Year Number].&[2009]
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

Author Comment

by:StacyThomas
ID: 26283543
Thanks, srnar, but that's still not giving me what I need.  I'd like it to return the number "4" (since there were 4 quarters in 2009), but what I get now is below after using the code I'm attaching.

Does it matter that I don't have the Date dimension in a hierarchy?

WITH  MEMBER measures.X AS
 [Date].[Quarter].CurrentMember.children.count
SELECT 
   {Measures.X, Measures.Actual} ON columns,
  [Date].[Quarter].CurrentMember ON rows
FROM [CubeName]
WHERE [Date].[Year Number].&[2009]

Open in new window

MDXError.bmp
0
 
LVL 8

Expert Comment

by:srnar
ID: 26284174
Hmm, do you have some time hierarchy where the quarter is under the year level?
The above example uses 2 different hierarchies (year number, quarter). It is basically possible to find some values in hierarchy by a key but I have no experience with this (some MDX link or lookup function).

0
 

Accepted Solution

by:
StacyThomas earned 0 total points
ID: 26285310
Thanks for trying srnar.  I'm using it in an ASP.NET application, and there's another way I can get the information, so I'll just do it that way instead of this way.

I really appreciate your suggestions!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Jet database engine errors can crop up out of nowhere to disrupt the working of the Exchange server. Decoding why a particular error occurs goes a long way in determining the right solution for it.
Blockchain technology enhances society similar to the Internet. Its effects are broad, disruptive, and will boost global productivity.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

581 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