Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Posts
    1

    Cool Unanswered: How to Calculate Sum for distinct values in MDX

    Hi ALL,
    I need help in calculating sum of market value based on property_id. The sum should be calculated by finding the average market value for a given property and then sum the individual average of the property to get the Distinct sum.

    I have a very little knowlegde in Cubes and analysis services. I need to perform this distinct sum by using calculated members using MDX on SQL server 2000.

    Data example

    P_Code Cus Prpty_Id Mrkt Val

    3000 1234 1111 $10,000 $10,000
    3000 1234 2222 $20,000
    3000 1234 3333 $30,000 $20,000
    3000 5678 1111 $10,000
    3000 5678 2222 $20,000 $30,000
    3000 5678 3333 $30,000
    3000 1020 1111 $10,000
    3000 1020 3333 $30,000

    Distinct Sum $60,000

    Thanks in Advance

    Brijesh
    Last edited by mail_brijesh; 07-27-07 at 10:15.

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    What about
    Code:
    SELECT SUM(DISTINCT Mrkt)
    FROM tbl
    GROUP BY P_Code
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    George
    Home | Blog

Posting Permissions

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