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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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