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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Massimo
Frequent Visitor

multiplication between two field of two releted table

hello everyone, I am a new user of powerbi . I want to know how i can , having two related tables one containing , for each product for each sale made , the amount sold and the invoice value ; in the other table I have the unit costs for each product . Should I create a measure that is the result of the multiplication between the quantity sold of each product to the unit cost of each individual product . Thanks for your help.

2 ACCEPTED SOLUTIONS
CheenuSing
Community Champion
Community Champion

@Massimo

 

Yes you should create a measure for the cost of items sold.

What needs to be done is

1. The Sales and Cost tables should be linked using the Product column in both the tables.

2. Create Measure

    CostofSold:=SUMX('SalesTable',[InvoiceQty] *Related(CostTable[Cost]))

3. This will create total of the cost for all the poroducts sold.

4. This measure will get filtered based on the filters / slicers in your application.

 

If this is what you are looking for please accept as a solution and also give kudos.

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

v-sihou-msft
Microsoft Employee
Microsoft Employee

@Massimo

 

In this scenario, you can create either a measure or a column to get expected result.

 

Cost_of_Sold_Measure = 
SUMX ( Sales, Sales[Amount Sold] * RELATED ( Cost[Unit Cost] ) )
Cost_of_Sold_Column = 
Sales[Amount Sold] * RELATED ( Cost[Unit Cost] )

156.png

 

Regards,

View solution in original post

9 REPLIES 9
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Massimo

 

In this scenario, you can create either a measure or a column to get expected result.

 

Cost_of_Sold_Measure = 
SUMX ( Sales, Sales[Amount Sold] * RELATED ( Cost[Unit Cost] ) )
Cost_of_Sold_Column = 
Sales[Amount Sold] * RELATED ( Cost[Unit Cost] )

156.png

 

Regards,

Thank may come in handy in other situations  😉

Baskar
Resident Rockstar
Resident Rockstar

Hi Massimo,

 

Cool ya , it is very simple in power BI.

 

Before creating the new measure ensure u have relationship with two tables. 

 

we have several options to solve your prob , pls try this below one .

 

Measure = sum("Table 1 Sales") * sum("Table 2 Cost")

 

if not , let me know

Thanks !!!!

CheenuSing
Community Champion
Community Champion

@Massimo

 

Yes you should create a measure for the cost of items sold.

What needs to be done is

1. The Sales and Cost tables should be linked using the Product column in both the tables.

2. Create Measure

    CostofSold:=SUMX('SalesTable',[InvoiceQty] *Related(CostTable[Cost]))

3. This will create total of the cost for all the poroducts sold.

4. This measure will get filtered based on the filters / slicers in your application.

 

If this is what you are looking for please accept as a solution and also give kudos.

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

I am applying the same formula but SumX is killing with 14 million. Response time SUCKS!

Just what I needed too, thanks.

Perfect thank you very much! Smiley Happy

Perfect thank you very much! Smiley Wink

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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