Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List dimension members with MDX query

Tags:

ssas

mdx

Is there a way to list dimension members without fetching default Measure for each member?

like image 738
Žygimantas Avatar asked Jun 07 '11 14:06

Žygimantas


People also ask

What is a dimension in MDX?

Dimensions, attributes, hierarchies, and levels, are the way we define our business model in MDX. They represent a meta-definition of our data, similar to tables and columns in SQL. Dimensions represent our main business concepts and are a generalization of concrete entities (Geography, Time, or Products).

How do I check MDX queries?

Testing MDX QueriesOpen SSMS and connect to the Analysis Services server. Right-click on the SSAS database and click New Query -> MDX to open and create a new MDX query. Press Ctrl+V to paste the query text that you captured in the profiler.

What is MDX calculated member?

In Multidimensional Expressions (MDX), a calculated member is a member that is resolved by calculating an MDX expression to return a value. This innocuous definition covers an incredible amount of ground.

What is the use of MDX query?

Multidimensional Expressions (MDX) lets you query multidimensional objects, such as cubes, and return multidimensional cellsets that contain the cube's data.


2 Answers

You could SELECT nothing on the opposite axis:

SELECT
  { } on 0,
  { DESCENDANTS([Dimension].[Hierarchy]) } on 1
FROM [Cube]

SELECTing an empty set prevents SSAS from adding the default measure on the opposite axis.

like image 157
Tullo_x86 Avatar answered Sep 21 '22 13:09

Tullo_x86


You can access the catalog views which Magnus mentions (which by the way are documented here), from SQL Server 2008 using the following SQL syntax instead of MDX:

SELECT *
  FROM $system.MDSCHEMA_MEMBERS
 WHERE ...

The SQL understood by Analysis Services is limited: There are no joins possible, and the WHERE condition may only contain clauses like [HIERARCHY_UNIQUE_NAME] = '[Date].[Order Date]' connected via AND. GROUP BY and ORDER BY are not supported. But nevertheless, you can query the cube meta data.

Depending on the interface you are using to access Analysis Services there might be some issues, as these metadata are returned in resultset format, not in cellset format.

like image 40
FrankPl Avatar answered Sep 25 '22 13:09

FrankPl