• subscribe
December 20, 2000 12:00 AM

December MDX Puzzle Solution Revealed

SQL Server Pro
InstantDoc ID #16057

Using the FoodMart (or FoodMart 2000) Sales cube, how can you determine which male customers with at least a college education bought the most different types of products?

WITH member [Measures].[Prod Count] AS 'Count( Filter( [Product].[Product
   Name].Members, NOT IsEmpty([Unit Sales]) ) )'
SELECT {[Unit Sales]} ON Columns,
   TopCount([Customers].[Name].Members, 10,( [Prod Count], [Bachelors
	Degree], [M] ) + ( [Prod Count], [Graduate Degree], [M] )) ON Rows
FROM [Sales]

This MDX query works by using a calculated measure called Prod Count, which returns the number of product types that had unit sales. The query uses the TopCount function to return the top 10 customers based on the Prod Count measure. You further limit the customers to males with a college education by adding the Prod Count for males with bachelor's degrees and Prod Count for males with graduate degrees. But watch out! This query takes a while to execute.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here