August 19, 2003 03:19 PM

August 2003 MDX Puzzle Solution

Rating: (0)
SQL Server Magazine
InstantDoc ID #39705
Problem: How would you write a query to find the top 10 customers based on unit sales who aren't single and female? Can you do it without listing any of the three other combinations (i.e., single male, married male, and married female)?

Solution: As Listing A shows, I answered this problem by filtering out the single, female customers before ranking the remaining customers with a TOPCOUNT() function. As you can see in the FILTER(...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

In reviewing this solution, the code to filter only those customers that are not single or female doesn't make sense. When I change the filter condition to "> 0" from '= 0" and drop the Topcount, I see only customers that are single and female. (Kinda what I would expect). Then change it back to "> 0" and I see the other possible combinations (Married and Female or Single and Male, etc) and single and female if the unit sales is null. Doesn't make sense. Can someone give me a better explanation for this behavior.

Thanks,
Jeff

Jeff Jones 10/3/2003 1:13:03 PM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS