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
Sasha
Helper III
Helper III

The need of calculate for total profit column

Hi,

 

In my products table, I would like to calculate a total profit for each product, using Qty, and Profit/Qty from sales table.

What will be the syntax?

Must I use RELATED and/or CALCULATE?

Thank you,

Alex

 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Sasha,

 

If you use a table visual, you can directly drag Products[ProductName] and Sales[Qty] into table visual. Choose the sum aggregation for Qty.

1.PNG

 

If you want to add a calculated column to show total Qty in Product table, please refer to below DAX:

total Qty = CALCULATE(SUM(Sales[Qty]),USERELATIONSHIP(Products[ProductName],Sales[ProductName]))

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Sasha,

 

If you use a table visual, you can directly drag Products[ProductName] and Sales[Qty] into table visual. Choose the sum aggregation for Qty.

1.PNG

 

If you want to add a calculated column to show total Qty in Product table, please refer to below DAX:

total Qty = CALCULATE(SUM(Sales[Qty]),USERELATIONSHIP(Products[ProductName],Sales[ProductName]))

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
LivioLanzo
Solution Sage
Solution Sage

i @Sasha, this highly depends on your data model

 


 


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


Proud to be a Datanaut!  

Only Sales and Products exist - one to many on the product id.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.