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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
kseeger
Regular Visitor

Sum of data trom child table.

Hello,

 

I have 2 tables as follows:

 

Sales invoice header:

  • ID
  • Customer
  • Sales amount (sum of "sales invoice line" sales amount)

 

Sales invoice line:

  • ID
  • sales line amount

The relation is on ID one to many (one header, several sales line).

 

I want to sum all sales line in for each ID in the "sales invoice header" in a new colume Sales amount (as mared in red above).

 

What dax function can do that?

 

3 REPLIES 3
Anonymous
Not applicable

@kseeger Please try following measure in sales Invoice Header

 

Measure = SUMX(RELATEDTABLE(Sales invoice line),Sales invoice line[Saleline])

 

In case it doesn't work please share sample data along with expected result after masking sensitive data 

Sales invoice header

ID             Customer

220100     a

220101     b

220102     c

220103     d

 

Sales invoice line
IDSales line amount
220100100
220100200
220100100
220101130
220101100
220101200
220101150
220102150
220102200
220102320
220102105
220102160
220102130
220103200
220103261
220103360
220103120

 

This is what i need to get:

 

Sales invoice header

ID          Customer           Sales amount

220100  a                         400

220101  b                         580

220102  c                         1065

220103  d                         941

 

 

 

 

Anonymous
Not applicable

@kseeger 

Measure = SUMX(RELATEDTABLE('Sales invoice line'),'Sales invoice line'[Sales line amount])

Please create this measure in Sales Invoice header and create relationship between this two tablesRelationship.pngkseeger.png 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.