Forum Discussion

Justas4478's avatar
Justas4478
Post Prodigy
1 year ago
Solved

Count counting some items twice

Hi, I have count measure. COUNT('Outbound Delivery'[Actual]) But some of the values it is counting twice. The actual count should be 230954 I am not sure why it is doing that. Is it faul o...
  • v-sgandrathi's avatar
    v-sgandrathi
    1 year ago

    HI Justas4478,

    Thank you for the clarification and work in identifying the root cause.
    You are right, the inflated count was due to row duplication caused by the ItemNumber column, which introduced a lower granularity than necessary.
    Since your reporting logic considers the combination of Date, Document Number, and SKU as the lowest meaningful level, aggregating at that level is both valid and recommended.

    Given that these fields are located in separate dimension tables, using the corresponding foreign keys from the 'Outbound Delivery' fact table is the most efficient and model-aligned solution.

    Given that these fields reside in separate dimension tables, using the corresponding foreign keys from the 'Outbound Delivery' fact table is the most efficient and model aligned solution.

     

    Corrected Count =
    COUNTROWS(
    SUMMARIZE(
    'Outbound Delivery',
    'Outbound Delivery'[DateKey],
    'Outbound Delivery'[OutboundDeliveryDocumentKey],
    'Outbound Delivery'[ProductKey]
    )
    )

     

    We'll continue exploring if there are further opportunities or edge cases to enhance this further, but for now, your current solution is accurate and reliable.

     

    If the solution worked for you, please click Accept as Solution and feel free to leave a Kudos for visibility.

     

    Thank you,
    Sahasra.