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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

New column to calculate profit value

Hi, Is it possible to add a new column that calculates the value using the relationships between the 3 tables?

Actually, I want to calculate the total profit of each country, of a real estate company that have branches in many countries and each branch, has many properties

Table 1: Country Id, Country Name

Table 2: Country Id, Property Id

Table3: Property Id, Profit

The difficulty is that there are several properties in each country, which means several values represent the profits in each country. so the query should sum all these profit values for each country.

you can see the actual tables in this link: https://prntscr.com/118mfhb

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

To show the result clearly, have modified your sample data. Based on your description, DAX and power query both could achieve this.

1. You can use DAX formula to create a calculated column directly:

TotalProfit =
CALCULATE (
    SUM ( Profit[TotalProfit] ),
    'Country'[CountryID] IN DISTINCT ( 'Property'[CountryID] ),
    'Property'[PropertyID] IN DISTINCT ( 'Profit'[PropertyID] )
)

r2.png

 

2. You can also use the 'Merge' feature in power query to merge table twice to get the same result:

m1.pngm2.pngr1.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

To show the result clearly, have modified your sample data. Based on your description, DAX and power query both could achieve this.

1. You can use DAX formula to create a calculated column directly:

TotalProfit =
CALCULATE (
    SUM ( Profit[TotalProfit] ),
    'Country'[CountryID] IN DISTINCT ( 'Property'[CountryID] ),
    'Property'[PropertyID] IN DISTINCT ( 'Profit'[PropertyID] )
)

r2.png

 

2. You can also use the 'Merge' feature in power query to merge table twice to get the same result:

m1.pngm2.pngr1.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you so much for this clear answer

sayaliredij
Solution Sage
Solution Sage

I think this problem is easily addressed if you just import this table in power bi and make the relationship between them.

You can create a measure 

Profit = SUM(Profit)

In this way, you can have profit available on each level . You just need to drag and drop columns

In case you want to create new table out of it

 

CountryWise = SUMMERIZECOLUMNS( CountryName, "Profit", SUM(Profit))

 

Regards,

Sayali 

 

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

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors