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
ASuhaji
Frequent Visitor

DAX Measure: Sum numbers from another table

Hello Everyone,

 

A simple measure question, but I can't find any solution.

 

A short example. I have 2 tables with these values:

ASuhaji_5-1685734608721.png

 

And this is what I want to achieve:

ASuhaji_3-1685734358928.png

 

It seems to be logical but it doesn't work:

Measure =
    VAR Table1_Sum = SUM(Table1[Count])
    VAR Table2_Sum = SUM(Table2[Count])
   
    RETURN
        DIVIDE(Table1_Sum, Table2_Sum)
 
Or: 
Measure =
    VAR Table2_Sum = SUM(Table2[Count])
    VAR Table2_ID = MAX(Table2[Id])
   
    RETURN
        CALCULATE(
            DIVIDE(SUM(Table1[Count]), Table2_Sum),
            Table1[Id] = Table2_ID
        )
 
Thank you for your help in advance.
1 REPLY 1
vanessafvg
Super User
Super User

the simple solution is how you model this data

 

create a bridge table, which is the unique  list of all your id's  in both tables, and then hook up both of tables to to the unique id table. 

then using your  new unique values of id's table, you place the ids from that table on the visual and the values you want from each of the tables and you should be able to compare.

 

if you give data in text format i can create it for you, bit it requires data in a usuable text format to copy and paste, or provide your pbix.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.