Tuesday, June 22, 2010

MDX Puzzle #1

Recently, I embarked on a mission to become proficient at writing MDX queries.  This is a challenge, as many of you may already know.  MDX, though a query language, is very different from T-SQL as I quickly found out.  Each week I will share with you a puzzle and then a couple of days later I will share my solution.   Please don’t post your solutions on this blog post.  Only post them on the Solution post, which will contain Solution in the title. Each solution post will contain a section on terminology and concepts if any new ones are introduced and the MDX query that is the solution to the puzzle.  In this first posting there will be a few.  The puzzles will start out very basic, but will move to more advanced MDX techniques as time progresses and my skills improve.  I will be using the Adventure Works 2008 R2 cube, which can be downloaded from codeplex.  So, let’s get started.

My first puzzle was to write what I thought was a very simple query.  Here is the puzzle:

Show:  Product Internet Sales and Order Quantity Measures
Rows:  Product Categories and SubCategories
Columns:  Ship Years
Filter:  Only Show Men from Customer Dimension and Exclude NULL values

Hint:  You will need a tuple for year and measures and for the rows.

Remember, don’t post you solutions here.  Save them for my solution post.  I will post it along with the steps that was taken to solve the puzzle in a couple of days.   Here is a screen shot of what the results should look like:

image

Don’t forget to check back in a couple days for the solution.

Talk to you soon,

Patrick LeBlanc

Founder www.TSQLScripts.com and www.SQLLunch.com.

Visit www.BIDN.com, Bring Business Intelligence to your company.

1 comment: