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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Calculate a summary resale per product

Hi, I am struggling to calculate a summary per product in the following data structure:

 

Table1 - Customer DB

Customer NameAddressNo of Employees
Cust1Address_Cust15
Cust2Address_Cust210

 

Table2 - Sales YTD

Customer NameProduct nameQTYValue
Cust1A510
Cust1B1010
Cust1C12
Cust2A510
Cust2B1010
Cust2C12

 

Table3 - Sales current month:

Customer NameProduct nameQTYValue
Cust1A510
Cust2B1010
Cust1A12
Cust1C515
Cust2A12
Cust1C1030
Cust2A2550
Cust2B1010

 

Data structure:

DmitryVasilenko_0-1670919121819.png

 

I am using the following measure to calculate Total sales:

 

Total Sales = SUM(Sales_current_mnth[Value]) + SUM(Sales_YTD[Value])

 

If I try to calculate the Total sales per product the result is incorrect. If I try to add a relationship between Sales_YTD and Sales_current_mnth over Product Name, Power BI asks to deactivate existing relationship, which brings to incorrect calcutaion of Total Sales per Customer name. 

 

What can be done to overcome the issue? 

2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @Anonymous 

 

try to

1) add a product table;

2) connect with two sales tables with one to many relationships;

3) plot with the product column from the product table. 

View solution in original post

Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _sum1=
SUMX(FILTER(ALL('Table3 - Sales current month'),'Table3 - Sales current month'[Product name]=MAX('Table2 - Sales YTD'[Product name])),[Value])
var _sum2=
SUMX(FILTER(ALL('Table2 - Sales YTD') ,'Table2 - Sales YTD'[Product name]=MAX('Table2 - Sales YTD'[Product name])),[Value])
return
_sum1 + _sum2

2. Result:

vyangliumsft_0-1670999085087.png

 

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _sum1=
SUMX(FILTER(ALL('Table3 - Sales current month'),'Table3 - Sales current month'[Product name]=MAX('Table2 - Sales YTD'[Product name])),[Value])
var _sum2=
SUMX(FILTER(ALL('Table2 - Sales YTD') ,'Table2 - Sales YTD'[Product name]=MAX('Table2 - Sales YTD'[Product name])),[Value])
return
_sum1 + _sum2

2. Result:

vyangliumsft_0-1670999085087.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

FreemanZ
Super User
Super User

hi @Anonymous 

 

try to

1) add a product table;

2) connect with two sales tables with one to many relationships;

3) plot with the product column from the product table. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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