Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8061465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:20:57+00:00 2026-06-05T10:20:57+00:00

I have a fact table with the following rows: WorkerName, OrderId, NumberOfPackagesPerOrder Note that

  • 0

I have a fact table with the following rows:

WorkerName, OrderId, NumberOfPackagesPerOrder

Note that neither WorkerName nor OrderId is unique in this fact table.
Multiple users could work on a single OrderId
Also note that NumberOfPackagesPerOrder only depends on the OrderId, i.e. for every OrderId, the number of NumberOfPackagesPerOrder will be the same.

I am trying to build a cube to report hierarchical report from this data by employee hierarchy:

ManagerLevel1           [Total orders completed] [Total Packages Shipped]
    Managerlevel2
      .....
        ManagerLevelN
                  Worker

Since multiple workers could work on the same order, I need to avoid double counting PackagesPerOrder for manager levels (non leaf nodes).

Manager hierarchy is defined recursively, i.e. it is not static.

Managers could also ship packages.

How to do this? What MDX Script do I need to properly SUM’ing NumberOfPackagesPerOrder by summing these only after DISTINC’ ing these by OrderId?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:20:58+00:00Added an answer on June 5, 2026 at 10:20 am

    The easiest way to do this is not to use an MDX Script at all but to implement a many-to-many relationship. Based on what you’ve described, I can’t give you a complete description of what’s necessary but I mocked up an example and got correct values. I have a worker dimension set up with hierarchical relationships to managers as you describe – using a parent-child structure. I have a fact table with worker, order id, and number of packages. In this last case, the number of packages isn’t really necessary – it should be ignored. I added a second fact table to have distinct values for order ID and number of packages.

    Then in the SSAS project, I have two dimensions – one for worker and one for order ID.

    Then I create a cube with two measure groups – one for each fact table. The one with worker and order ID can use the number of packages or a count of rows – it doesn’t matter, but the measure needs to be hidden. It’s just used as an intermediate fact table for the many-to-many.

    Then the fact table that has the distinct order id and number of packages is the second measure group. You can add an order count and use the number of packages as two separate measures in this measure group.

    On the dimension usage tab, Worker and Order ID have a relationship to the intermediate fact table (worker and order ID columns in that fact table). Order ID also has a regular relationship to the fact table with order ID and number of packages. Worker has a many-to-many relationship to this fact table (the one with unique order ID) using the other fact table as the intermediate measure group.

    When you set it up this way, your order count and number of packages roll up correctly by worker and by manager at all levels of the hierarchy. No MDX required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table (table variable in-fact) that holds several thousand (50k approx) rows
I have multiple threads that are processing rows from the same table that is
I have a fact table that needs a join to a dimension table however
Okay, so I have this problem with my Fact Table. I need it to
Say I have Table1 which has duplicate rows (forget the fact that it has
I have a table of data that looks a bit like this: Name StartTime
I have the following scenario: a table that is accessed (update, delete, insert and
Can a fact table have no keys at all? or if it can, is
Consider a grocery store scenario (I'm making this up) where you have FACT records
I have a code problem which stems from the fact that I am using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.