Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Lesny
New Member

Sum is not presented correctly

Hi,

Could you please help and explain what I'm doing wrong here?

I've got a two tables with relation based on column "Product Family". Let's assume they both looks:

Lesny_0-1734085583217.png 

Lesny_1-1734085605201.png

when I'm building an overview I receive:

Lesny_2-1734085647907.png

How to change this?

1 ACCEPTED SOLUTION
grazitti_sapna
Super User
Super User

Hi @Lesny,

The issue in your Power BI report can be due to a many-to-many relationship between Table 1 and Table 2, both of which are related on the Product Family column. Here's how to fix and address the problem step by step:

Possible Reason for the Incorrect Totals

  1. You have a direct relationship between Product Family in Table 1 and Table 2.
  2. When you add Sales and Costs to your matrix, Power BI does not properly aggregate the data for each combination because it does not know how to match Sales with Costs by row unless explicitly guided.
    This results in duplicating or inflating totals in your report.

Possible Fixes and Solutions

Option 1: Use a Bridge Table

  1. Create a Bridge Table:
    • Extract a unique list of Product Family values from both Table 1 and Table 2.
    • Name this table Product Family Bridge.
      Example DAX to create the bridge table:
      ProductFamilyBridge = DISTINCT(

      UNION(

      SELECTCOLUMNS(Table1, "Product Family", Table1[Product Family]),

      SELECTCOLUMNS(Table2, "Product Family", Table2[Product Family])

      )

      )
  2. Define Relationships:

     

    • Remove the direct relationship between Table 1 and Table 2.

    • Connect Product Family in Table 1 to Product Family in Product Family Bridge.

    • Connect Product Family in Table 2 to Product Family in Product Family Bridge.

  3. Update Your Matrix:

     

    • Use the Product Family field from the Product Family Bridge table in your visual.

    • Add Sales from Table 1 and Costs from Table 2.
      This ensures Power BI aggregates the data correctly without duplication.

Option 2: Use a Composite Model with Measures
If you prefer to avoid creating a bridge table, you can handle the relationship via explicit measures:

  1. Create a Measure for Sales:
    TotalSales = SUM(Table1[Sales])

  2. Create a Measure for Costs:
    TotalCosts = SUM(Table2[Cost])
  3. Use These Measures in Your Matrix:

     

    • Add Product Family from either table to your matrix.

    • Use TotalSales and TotalCosts as the values.
      Power BI will correctly compute totals without inflating them.

Option 3: Use the Country Field for Additional Granularity
If Country is important for your analysis, ensure relationships also consider Country:

  • You can create a concatenated column in both tables:
    ProductCountryKey = 'Table'[Product Family] & "-" & 'Table'[Country]
  • Use this concatenated column to establish a 1-to-1 relationship between Table 1 and Table 2.

I hope the provided multiple options works for you

If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.

 

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Why are your tables with the same structure separate?










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello. The whole structure is not the same. I simplified the table to show the problem.

grazitti_sapna
Super User
Super User

Hi @Lesny,

The issue in your Power BI report can be due to a many-to-many relationship between Table 1 and Table 2, both of which are related on the Product Family column. Here's how to fix and address the problem step by step:

Possible Reason for the Incorrect Totals

  1. You have a direct relationship between Product Family in Table 1 and Table 2.
  2. When you add Sales and Costs to your matrix, Power BI does not properly aggregate the data for each combination because it does not know how to match Sales with Costs by row unless explicitly guided.
    This results in duplicating or inflating totals in your report.

Possible Fixes and Solutions

Option 1: Use a Bridge Table

  1. Create a Bridge Table:
    • Extract a unique list of Product Family values from both Table 1 and Table 2.
    • Name this table Product Family Bridge.
      Example DAX to create the bridge table:
      ProductFamilyBridge = DISTINCT(

      UNION(

      SELECTCOLUMNS(Table1, "Product Family", Table1[Product Family]),

      SELECTCOLUMNS(Table2, "Product Family", Table2[Product Family])

      )

      )
  2. Define Relationships:

     

    • Remove the direct relationship between Table 1 and Table 2.

    • Connect Product Family in Table 1 to Product Family in Product Family Bridge.

    • Connect Product Family in Table 2 to Product Family in Product Family Bridge.

  3. Update Your Matrix:

     

    • Use the Product Family field from the Product Family Bridge table in your visual.

    • Add Sales from Table 1 and Costs from Table 2.
      This ensures Power BI aggregates the data correctly without duplication.

Option 2: Use a Composite Model with Measures
If you prefer to avoid creating a bridge table, you can handle the relationship via explicit measures:

  1. Create a Measure for Sales:
    TotalSales = SUM(Table1[Sales])

  2. Create a Measure for Costs:
    TotalCosts = SUM(Table2[Cost])
  3. Use These Measures in Your Matrix:

     

    • Add Product Family from either table to your matrix.

    • Use TotalSales and TotalCosts as the values.
      Power BI will correctly compute totals without inflating them.

Option 3: Use the Country Field for Additional Granularity
If Country is important for your analysis, ensure relationships also consider Country:

  • You can create a concatenated column in both tables:
    ProductCountryKey = 'Table'[Product Family] & "-" & 'Table'[Country]
  • Use this concatenated column to establish a 1-to-1 relationship between Table 1 and Table 2.

I hope the provided multiple options works for you

If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.

 

Thank you. Solution 1 and 3 helped 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.