• 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
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...