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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ytc-reports
Helper I
Helper I

Probably Extremely Easy Question - Sum Column on one Table from Matching Rows on Other Table

I have a question today that I think most of you will find quite easy, but I'm really struggling with.

 

I have an Item table, and each row on the Item table of course represents one Item. Each item is identified by the No_ field.

 

No_Description
AStock Item A
BSales Item B
CChristmas Item C

 

I have another table, purchase_lines, connected to it with a related field Item No_:

 

Item No_Quantity
A2
A3
B6
C7
C3

 

What I need is a column on the first table that sums up matching rows on the second table. 

 

Now your first instinct is going to be to tell me I can just drag the Quantity column into my report and it will sum up correctly there, and *you'd be correct*, but that's not what I need to do with this column. I'm doing some other complex stuff with other related tables and I really do need a calculated column on the Item table. A column that ends up looking like this:

 

No_DescriptionQtySum
AStock Item A5
BSales Item B6
CChristmas Item C10

 

I've tried Calculating and SumX-ing and I just can't figure out what to do. Please help.

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@ytc-reports

 

Use this and let me know if works

 

QtySum = CALCULATE(Sum(TableB[Quantity]))




Lima - Peru

View solution in original post

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@ytc-reports

 

Use this and let me know if works

 

QtySum = CALCULATE(Sum(TableB[Quantity]))




Lima - Peru

@Vvelarde I think that may have worked! I feel so stupid, as that's so simple and I've used those things countless times before. I was just summing it, or trying to do calculate(sum and then putting a filter in there. I was overcomplicating it. Thanks so much!

Anonymous
Not applicable

Hi YTC have you looked at the Related() function?

@Anonymous yes and that works great in a 1:many relationship for referencing values on the 1: side of that relationship on the table with the :many side. But I'm doing the reverse, which is why I'm struggling.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.