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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
kevbrown1980
Frequent Visitor

Calculations

Hi

 

I have 2 table with joined, 1 table has my cost data and the other the volume data. The cost table is 1 line per team however the volume table is multiple row per department giving an overal volume amount. The table below might show it better. I need to multiple the team cost in table 1 by the Vol in table 2 however I only need 10 for example for Code 1, so basically the unique number in Vol per code. How do I do that?

 

Table A    Table 2    Result 
            
CodeTeamCost  CodeDeptVol  TeamTotal Cost
1Green £  200.00  1A10  Green £  2,000.00
2Yellow £  430.00  1B10  Yellow £  2,150.00
3Red £  127.00  1C10  Red £  1,524.00
4Orange £  267.00  1D10  Orange £  8,010.00
5Blue £  205.00  2A5  Blue £  4,305.00
     2B5    
     2R5    
     3C12    
     4H30    
     4D30    
     4R30    
     4T30    
     5H21    
     5J21    
     5F21    
     5T21    
     5G21    
     5D21    
     5S21    
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @kevbrown1980 

 

If the code in Table A is always unique, you can create a one-to-many single direction relationship from Table A to B on code. Then create this measure (assuming there's only one distinct vol value per team regardless of the department):

danextian_0-1755860930264.png

total cost = 
SUMX (
    VALUES ( TableA[Code] ),
    CALCULATE ( MAX ( TableB[Vol] ) ) * CALCULATE ( SUM ( TableA[Cost] ) )
)

danextian_1-1755861191911.png

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

You may write these calculated column formulas in Table1

Volume = calculate(min('Table2'[Vol]),filter('Table2','Table2'[Code]=earlier('Table1'[Code])))

Total = 'Table1'[Cost]*'Table1'[Volume]

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-dineshya
Community Support
Community Support

Hi @kevbrown1980 ,

Thank you for reaching out to the Microsoft Community Forum.

 

Hi @johnt75 , @danextian , Thank you for your prompt responses.

 

Hi @kevbrown1980 ,  Could you please try the proposed solutions shared by @johnt75  and @danextian . 

Please do let us know if you have any further queries.

 

Regards,

Dinesh

Hi @kevbrown1980 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @kevbrown1980 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @kevbrown1980 ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

danextian
Super User
Super User

Hi @kevbrown1980 

 

If the code in Table A is always unique, you can create a one-to-many single direction relationship from Table A to B on code. Then create this measure (assuming there's only one distinct vol value per team regardless of the department):

danextian_0-1755860930264.png

total cost = 
SUMX (
    VALUES ( TableA[Code] ),
    CALCULATE ( MAX ( TableB[Vol] ) ) * CALCULATE ( SUM ( TableA[Cost] ) )
)

danextian_1-1755861191911.png

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
johnt75
Super User
Super User

If you have a one-to-many relationship from 'Table A' to 'Table 2' you can create a measure like

Total Cost = SUMX(
    'Table A',
    VAR Volume = SUMX(
        CALCULATETABLE(DISTINCT('Table 2'[Vol])),
        'Table 2'[Vol]
    )
    VAR Result = 'Table A'[Cost] * Volume
    RETURN
        Result
)

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.