Many thanks to everyone who attended my session today, Introduction to MDX. There was so much more I wanted to say, but the constraint of an hour required me to be very selective and, as you might have noticed, to sacrifice the demos. After all, how exciting can it be to watch me execute a query? I thought it more important to provide you with the key concepts that you can use to get started.
When I first learned MDX, I didn't learn it the way that I explained it today. Consequently, I struggled for a long time until the proverbial light bulb turned on in my head about how to think about the language. I hope that my explanation saves you some of the grief that I experienced, although I can't promise that you aren't going to have (and lose) a few wrestling matches as you build up your MDX muscles.
As promised, I have sample queries that illustrate the concepts that I discussed today. Before you can run the queries, I assume that you have both a SQL Server 2008 R2 database instance and an Analysis Services instance. You will need to download and install the AdventureWorks 2008 R2 sample database. Then open the Intro to MDX solution included in the zip file and deploy the project to create the simple cube for the queries. Then open the MDX files in SQL Server Management Studio. You can run the entire script, and thereby execute multiple queries, or run one at a time by highlighting the query text as described in the header of each MDX file. These queries and the SSAS solution might work with earlier versions of SQL Server, but is untested.
Download the zip file containing the queries and SSAS solution here.
If you plan to attend the PASS Summit 2010 in Seattle, be sure to see my session, Demystifying MDX in Reporting Services, where I explain how to use MDX with Reporting Services. There are a few differences from the query structure that I described today that you'll need to know.