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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Carl143
Frequent Visitor

Populating a new column in Table 1 with Summed & Filtered data from Table 2

Hi am very new to PowerBi, so excuse the basic question

 

I have 2 Tables

Key is PN Column

Table 1

PN          New Column

1234

2222

3333

 

Table 2

PN      Location      QTY Available

1234   BNE             6

1234   CDC            8

2222   BNE             50 

2222   LAX             9

2222   SYD             2

3333   BNE            3

3333   CDC            4

3333   LAX             7

3333   SYD            1

 

Expected Result

 

Table 1

PN          New Column

1234        8

2222        0

3333        4

 

 

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I assume there is a relationship between the two tables like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1709614745926.png

Jihwan_Kim_1-1709614907429.png

 

 

RELATEDTABLE function (DAX) - DAX | Microsoft Learn

 

Expected result Calculated Column = 
SUMX (
    FILTER ( RELATEDTABLE ( 'Table 2' ), 'Table 2'[Location] = "CDC" ),
    'Table 2'[QTY Available]
) + 0

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Carl143
Frequent Visitor

Thanks Jihwan, this was perfect

View solution in original post

2 REPLIES 2
Carl143
Frequent Visitor

Thanks Jihwan, this was perfect

Jihwan_Kim
Super User
Super User

Hi,

I assume there is a relationship between the two tables like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1709614745926.png

Jihwan_Kim_1-1709614907429.png

 

 

RELATEDTABLE function (DAX) - DAX | Microsoft Learn

 

Expected result Calculated Column = 
SUMX (
    FILTER ( RELATEDTABLE ( 'Table 2' ), 'Table 2'[Location] = "CDC" ),
    'Table 2'[QTY Available]
) + 0

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.