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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.