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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Total row doesn't match with the individual row sum in Many to Many relationship using Bridge table

I have implemented many to many using Bridge table. (TableA *<--1 Bridge 1<->* TableB).

Now i have dropped an attribute from TableB and

DISTINCTCOUNT(TableA[Column1])

into a table visual. I was not able to match the individual row sum with Total row at the bottom of the visual. I know why i was not able to match because each row in TableA might be get shared across two rows in TableB (which is a double count of the same row), when it comes to Total row it is counted as one since we are using DistinctCount. I could use

SUMX(VALUES(TableB[Column1]),DISTINCTCOUNT(TableA[Column1]))

but if we have 5 columns in TableB i should write this SUMX 5 times by replacing the column value in the VALUES function and also it's not going to work because while calculating the Total row we can not get to know which column is being used in the visual so that that particular column should be used in SUMX(VALUES())). I tried using this

CALCULATE(DISTINCTCOUNT(TABLEA[Column1]_,Bridge)

 It doesn't work either.

Is there any way that i could overcome this issue ? Thanks in advance.

1 ACCEPTED SOLUTION

@Anonymous 

 

You may add CALCULATE as follows.

 

Measure =
SUMX (
    VALUES ( 'Sales Program'[Sales Industry] ),
    CALCULATE ( DISTINCTCOUNT ( Pipeline[Dim_OpportunityId] ) )
)

 

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Would need some sample data that recreates the issue. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Also, this looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks for the reply. I have attached the sample data. Please take a look. In Sales Program table i have only one attribute incase of sample but in my real data I have almost 10 attributes which are having the same issue. Please download the sample pbix file from this link Sample Data

Anonymous
Not applicable

@Greg_Deckler Can you please take a look at this ? Thanks! I have attached the sample pbix file.

@Anonymous 

 

You may add CALCULATE as follows.

 

Measure =
SUMX (
    VALUES ( 'Sales Program'[Sales Industry] ),
    CALCULATE ( DISTINCTCOUNT ( Pipeline[Dim_OpportunityId] ) )
)

 

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.