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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Ilija89
Regular Visitor

Calculating Weighted Sales

I need help in calculating weighted sales.

Context:

There are two tables; Sales transaction and Sales Weights tables (examples attached with dummy data).

Sales is divided into direct and indirect sales. If it is indirect sales is alocated to sales rep. who is covering that specific customer. On the other side if sales is direct, then sales amount should be splitted to sales reps by weights given in Sales Weights table.

Relationship between tables:

In order to create relationship between two tables, bridge table is created with unique code created by merging category and customer code.

  

How to create formula that will calculate weighted sales for direct sales for each sales rep per customer per category? Some switch formula 

Thanks

 

Bridge table

Bridge Table.png

Ilija89_0-1757324005721.png

Sales table

Sales Table.png

Weights table

Weights Table.png

 

7 REPLIES 7
v-dineshya
Community Support
Community Support

Hi @Ilija89 ,

Thank you for reaching out to the Microsoft Community Forum.

 

You are expecting  formula that will calculate weighted sales for direct sales for each sales rep per customer per category.

 

Please refer below output snap and attached PBIX file.

 

vdineshya_0-1757417782345.png

 

vdineshya_1-1757417827041.png

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

 

FBergamaschi
Solution Sage
Solution Sage

Hi @Ilija89 

I am almost there but it seems to me that the tables are not complete (?)


For example, in Sales there is a row for Cust KG, category 2 and Salesman AK which is not refelected in the weights table, am I wrong? If you can cover all the Sales cases in the weights table, that will help me debug and send you the solution

 

Thanks

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Hi @FBergamaschi this is the case that I am facing with. In tis particualr situation if for specific customer sales rep is asigned then sales is equal to that sales rep, in other case when sales is direct then  we should calculate that row by multypling that sales with weights given for that customer.

Ilija89
Regular Visitor

Weights

CustomerCategoryCustomer codeSales RepresentativeWeightCategory-Customer Code
AB11abA.K25%1_1ab
AB21abB.J100%2_1ab
AB11abG.L75%1_1ab
AC11acA.K33%1_1ac
AC11acB.J33%1_1ac
AC11acG.L33%1_1ac
AF21afA.K50%2_1af
AF21afB.J50%2_1af
AF11afG.L100%1_1af
KG11kgA.K50%1_1kg
KG21kgB.J100%2_1kg
KG11kgG.L50%1_1kg

 

Sales table

CustomerSales TypeCategoryDateCustomer codeSales amountSales RepCategory-Customer Code
ABDirect1Jan-251ab             423,423Direct1_1ab
ABIndirect1Feb-251ab               43,342G.L1_1ab
ACDirect2Jan-251ac         4,444,556Direct2_1ac
AFDirect1Feb-251af               44,656Direct1_1af
KGIndirect2Feb-251kg                 7,878A.K2_1kg

 

Bridge table

CustomerCategoryCustomer codeCategory-Customer Code
AB11ab1_1ab
AB21ab2_1ab
AC11ac1_1ac
AC21ac2_1ac
AF11af1_1af
AF21af2_1af
KG11kg1_1kg
KG21kg2_1kg

 

Hi @FBergamaschi above are dummy data examples.

Thanks!

 

Hi @Ilija89 ,

 

Please add an example of what you need as output? a table including customers, sales rep, and weights?!

Hi @Selva-Salimi I need output as total sales of particular sales rep (sum of direct and indirect sales).per category per customer.

Thanks, Ilija

FBergamaschi
Solution Sage
Solution Sage

Hi @Ilija89,

it seems nothing difficult but to help you in the best possible way, please can you attach the tables with dummy data in a usable format? Not an image but text

 

Thanks

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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