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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Row Total for a measure that evaluates two columns.

 

Hi All,

 

I'm fairly new to power bi and I've come across an issue that I cannot solve. Let me explain the situation.  I'm pulling data from two tables. Table1 has an invoice cost and Table2 has an actual cost(complete tables are included in the screenshot for reference). I've created a measure, Diff = sum(Table1[invoice cost]) - sum(Table2[) that properly calculates the difference on a line item level. However, for row totals the measure calculates invoice cost - sum(actual cost).  I've turned off row subtotals for the table on the right, example B, but this doesn't solve the issue because I'd still like to be able have a total for the difference, either a row total or a card with a total difference measure. I've looked at other solutions to solve this issue but those solutions(sumx, filters) are all for measures that just look at one table. 

 

Any help would be greatly appreciated! 

 

 

measuresAcrossTables.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank you!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Keeping the measure that you already have add the following measure:

 

Total_Diference = 

SUMX(ADDCOLUMNS(Table2;"Difference";[Diff]);[Difference])

Should work as expected.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @Anonymous ,

 

To understand better your model can you please check the questions below:

 

  • Are table 1 and Table 2 related in some way? If yes how?
  • What is the final result you want to get on the total column? 
    • 4 for the second table = 0,5 -2 -3 = 4

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi @MFelix 

Table 1 and Table 2 are not directly related, they are connected through a lookup tables. So there's a customer lookup table that contains all unique customer values between the two tables and a product lookup table that does the same. Table 1 and table 2 are both connected to the lookup tables but not too each other. If I try to connect the two in the actual model it creates a many to many connection and because of ambiguity won't let me activate it. 

 

To answer your second question: it should equal -4.5=0.5-2-3

 

Thank you for your help!

Hi @Anonymous ,

 

Keeping the measure that you already have add the following measure:

 

Total_Diference = 

SUMX(ADDCOLUMNS(Table2;"Difference";[Diff]);[Difference])

Should work as expected.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

It worked! Thank you so much! @MFelix 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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