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

add different columns from different tables without using sum function

hi Team,

 

I have 2 different tables

 Table1

 ID  Jun:A  Jul:A  Aug:A 
 123                   5,643                   9,876                   5,820
                 456                   7,639                   1,543                      777
                      789                   9,875                      567                   9,876

 

Table2

IDJun:FJul:FAug:F
123                   3,927                   6,762                   9,568
456                   6,926                   8,899                   4,826
789                   8,066                   8,188                   6,823

 

 

I want to add 3 columns to 2nd table whose formula will be:-  

Jun:A+Jul:F+Aug:F

Jun:A+Jul:A+Aug:F

Jun:A+Jul:A+Aug:A

 

When i am trying using -:Table1[Jun:A]+SUM(Table2[Jul:F]+SUM(Table2[Aug:F], I am not getting the result.

And without using SUM function the table2 is not being referenced.

 

Please help urgently.

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

I'd like to suggest you unpivot these column to attribute and value, then you can simply use calculate with attribute equal to specific value to get result.

Unpivot Data Using Excel Power Query

 

Measure =
VAR currID =
    MAX ( Table1[ID] )
VAR merged =
    UNION ( ALLSELECTED ( Table1 ), ALLSELECTED ( Table2 ) )
VAR attrList = { "Jun:A", "Jul:F", "Aug:F" }
RETURN
    SUMX ( FILTER ( merged, [ID] = currID && [Attribute] IN attrList ), [Value] )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Stachu
Community Champion
Community Champion

if it's calculated column in Table2 this should work

RELATED(Table1[Jun:A])+Table2[Jul:F]+Table2[Aug:F]

in Table1 this should work

Table1[Jun:A])+RELATED(Table2[Jul:F])+RELATED(Table2[Aug:F])


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.