Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Staff Sharing Sales

Hello, any help or ideas is appreciated.
I have a group of sales staff who share sales through what we call Rep Code. Each is assigned Rep Codes and some are shared.
The sales table has records of sales that identify which record is attributed back to the sales staff via Rep Code.
Problem I have is that each sales staff gets 100% attribution even if they share the Rep Code. This is for calculating their incentive for the sale.
I have tried grouping, tried creating a bridge table and using treatas with no satisfactory result. I need to show the total sales for each for all the Rep Codes an individual may have or share.
Here is a sample of my tables for Staff and Sales:

Staff NameRep Code
EliottEGRE
EliottGTEG
EliottHCEG
EliottJHEG
EliottNNEG
EliottRMEG
JohnnyGTEG
JohnnyGTES
JohnnyVANC
JordanEGRE
JordanGTEG
JordanHCEG
JordanJHEG
JordanJHNS
JordanJHOP
NazlinJHNS
NazlinNSUN
NazlinRMNS
RobertNSUN
RobertRMEG
RobertRMEH
RobertRMNS



Effective DateRep CodeAmount
12/29/2023NSUN99861.40
12/29/2023EGRE99707.14
12/29/2023JHOP99682.33
12/29/2023RMEG99436.98
12/29/2023NSUN99422.18
12/29/2023JHOP99356.25
12/29/2023GTEG99287.20
12/29/2023EGRE99041.38
12/29/2023EGRE990159.13
12/29/2023EGRE98809.19
12/29/2023GTEG98782.04
12/29/2023EGRE98647.74
  • Gotcha! OK - since that is what you want - here is how I did it... I took your Staff table and added that - then from that I created a dim table with just the Staff name and a dim table of just the rep codes. I then added in your Sales table. I then joined the Staff name dim to Staff table and the Rep Code dim to both the Staff (with a bi-directional join, which should be avoided, but it is needed here) and the Sales table (you would also need a date dim table so you could filter and stuff by dates, but I didn't do that here just to demo). In the visual, I put Staff name from the Staff Dim table and Rep code from the Rep Code dim table and the measure of Sales that I made using the sum of sales from the sales table. Here's the pbix I made: adrian_file 

8 Replies

  • Hii Anonymous 

    Step 1: Create a Calculated Column in the Staff Table

    Staff Count =
    VAR CurrentRepCode = Sales[Rep Code]
    RETURN
    CALCULATE(
    DISTINCTCOUNT(Staff[Staff Name]),
    Staff[Rep Code] = CurrentRepCode
    )


    Step 2: Create a Measure for Adjusted Sales Attribution

    Sales Attributed =
    VAR RepCodeCount =
    CALCULATE(
    DISTINCTCOUNT(Staff[Staff Name]),
    Staff[Rep Code] = SELECTEDVALUE(Sales[Rep Code])
    )

    RETURN
    SUM(Sales[Amount]) / RepCodeCount

     

     

    If this helps, I would appreciate your KUDOS!
    Did I answer your question? Mark my post as a solution!

  • Hi! Do you want it where each Sales Rep would show they Rep Codes associated with them and the total amount (i.e. anyone who shares that rep code shows that same amount), like below?

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      audreygerred Thanks for taking a look at this.
      Yes that's what I am after. The report eventually will be using RLS to allow individuals to view their own totals. For example if Eliott viewed the report he/she will see:

      EliottEGRE1,386,364.58
      EliottGTEG198,069.24
      EliottRMEG99,463.98

      Once this is achieved there is some underlying calculations to get here and then to the incentive which I have yet to get to. If I can help on this would be a big win for me as a base to start with the rest of the calculations. 

      • audreygerred's avatar
        audreygerred
        Icon for Super User rankSuper User

        Gotcha! OK - since that is what you want - here is how I did it... I took your Staff table and added that - then from that I created a dim table with just the Staff name and a dim table of just the rep codes. I then added in your Sales table. I then joined the Staff name dim to Staff table and the Rep Code dim to both the Staff (with a bi-directional join, which should be avoided, but it is needed here) and the Sales table (you would also need a date dim table so you could filter and stuff by dates, but I didn't do that here just to demo). In the visual, I put Staff name from the Staff Dim table and Rep code from the Rep Code dim table and the measure of Sales that I made using the sum of sales from the sales table. Here's the pbix I made: adrian_file