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

Create column from another table with sum

Oi.

Tenho uma tabela com informações de pedidos e outra referente aos lançamentos de NFs dos pedidos, gostaria de criar uma coluna na tabela de pedidos com a soma das na tabela de NFs pois existem várias NFs referentes a um pedido.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Greg5 ,

 

I think your tables should look like as below.

Orders:

RicoZhou_1-1675307465543.png

Invoice:

RicoZhou_0-1675307452784.png

Here are two workarounds to achieve your goal.

1. Create an active relationship between two tables by [Orders] columns.

RicoZhou_2-1675307565283.png

Sum of Invoice = CALCULATE(SUM(Invoice[Invoice]))

Result is as below.

RicoZhou_3-1675307619886.png

2. If you don't want to create a relationship or you want to inactive the relationship between two tables, try this code.

Sum of Invoice = CALCULATE(SUM(Invoice[Invoice]),FILTER(Invoice,Invoice[Orders] = EARLIER(Orders[Orders])))

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Greg5 ,

 

I think your tables should look like as below.

Orders:

RicoZhou_1-1675307465543.png

Invoice:

RicoZhou_0-1675307452784.png

Here are two workarounds to achieve your goal.

1. Create an active relationship between two tables by [Orders] columns.

RicoZhou_2-1675307565283.png

Sum of Invoice = CALCULATE(SUM(Invoice[Invoice]))

Result is as below.

RicoZhou_3-1675307619886.png

2. If you don't want to create a relationship or you want to inactive the relationship between two tables, try this code.

Sum of Invoice = CALCULATE(SUM(Invoice[Invoice]),FILTER(Invoice,Invoice[Orders] = EARLIER(Orders[Orders])))

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors