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
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
Employee
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
Employee
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
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.