Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    montréal
    Posts
    1

    Question Unanswered: TopCount of a TopCount in MDX

    I am looking to write a query that returns a result set that in effect is the Top 5 Stores based on sales of the Top 10 Selling Products. I am struggling with the MDX. I was trying different combinations of TopCount and Filter functions but with not much success. Any samples are appreciated. thanks.

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    something like

    select top 5 s.store_id, sales = sum(sps.sales)
    from stores s, storeproductsales sps
    where sps.product_id in
    (select top 10 product_id from productsale order by sales desc)
    and s.store_id = sps.store_id
    group by s.store_id
    order by sum(sps.sales) desc


    If you don't have the totals in tables already then create derived tables to do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •