some more MDX

Some fairly basic MDX stuff:

WITH
SET [a] AS [Geography].[City].[City] * [Product].[Category].Levels(1).Members 
SET [b] AS [Date].[Calendar].Levels(1).Members * [Sales Territory].[Sales Territory].[Country]
SELECT
     Order([a], [b].Item(0), BDESC ) ON ROWS
     ,[b]  ON COLUMNS
FROM [Adventure Works];

Use the * (asterisk) to separate multiple columns and rows. It’s a bit like a similar use in R when plotting against two things, I think the library(doBy) uses the same .

…with selection and NON EMPTY:

WITH
SET [a] AS	[Geography].[Country].&[Germany]
			*[Product].[Category].Levels(1).Members 
SET [b] AS	[Date].[Calendar].Levels(1).Members
			* [Sales Territory].[Sales Territory].[Country]
SELECT
     Order([a], [b].Item(0), BDESC ) ON ROWS
     ,non empty{[b]}  ON COLUMNS--[Geography].[City].&[Abingdon]&[ENG]
FROM [Adventure Works];

Leave a Reply