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
JeremiahMason
Advocate I
Advocate I

Calculate the sum of table 2 based on table 1, display the summaries of both tables in the same matrix

I have two tables that are of the same design but contain different values. Essentially, I just want to combine two arrays in a /show result of the summaries of each table into a single visual. The following example shows the visuals I have and what I'm trying to produce, rather than the data itself, that is, the arrays shown below are a summary of my much larger data.

have:

Table 1 Matrix 1

category

Dollars
B10
C10
D15
E20

Table 2 Matrix 2

category

Dollars
B5
C15
D10
E0

I want to:

A matrix showing both summaries in a single visual

category

T1 DollarsT2 Dollars
B105
C1015
D1510
E200

I tried using DAX to create a variable in table 1 that sums table 2 dollars based on my categories in table 1, but this failed.

Table2_Dollars de cálculo( SUM( 'Table2'[Dollars], FILTER( 'Table2', 'Table2'[Category] ? CALCULATE( VALUES( 'TABLE1'[Category]))))

Thanks in advance!

Update: Making a relationship between my two category variables worked for a single visual, but I want to repeat this several times for different variables that don't work because PBI doesn't let me have multiple active many-to-many relationships.

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @JeremiahMason ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
JeremiahMason
Advocate I
Advocate I

It's always right after you ask the question that you find the answer:

 

I created a many-to-many relationship between my category variables between my two tables and then simply adding the dollars field from the second table to the matrix I made with the first worked exactly as intended

Hi @JeremiahMason ,

 

We can try to make a dim table using following calculated table formula:

 

CategoryTable =
DISTINCT (
    UNION ( DISTINCT ( 'Table 1'[Category] ), DISTINCT ( 'Table 2'[Category] ) )
)

 

 

Then we can create 1:M relationship between dim table and other tables, use the Category table as the axis of chart to meet your requirement:

 

If you have any other questions, please kindly ask here and we will try to resolve it.


Best regards,

 

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

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.