+ Reply to Thread
Results 1 to 17 of 17

Add calculated item to pivot table

  1. #1
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    Add calculated item to pivot table

    Dear All

    Attached is a worksheet example, of my beauty salon with 5 therapists.

    The input sheet - is the shhet into which I input data on a daily basis.

    Weekly inc - This sheet shows the total that each therapist made in apivot table based on the input. The week numbers are 1 to 52 (or 53) depending on each financial year (07/08, 08/09 etc).

    What I want to do is either have another pivot table or to add an calculated item to the weekly inc pivot table showing me how much commission each therapist took each week? This is to be done automatically by excel.

    This commission is calcluated by using the target comm figures - E.G. Leanne's target is £480 - so she has to earn £480 a week before getting a commission. So if in a week she earns £500 - she will get a commission on £20 (£500 - £480). The commission is 10%, so she will earn £2 that week.

    Any help would be much appreciated.
    Attached Files Attached Files
    Last edited by tony0710; 07-08-2009 at 10:22 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    re: Add calculated item to pivot table

    Hi

    As you have some formula in the input sheet, how about adding some additional formulas that will work out the commission, and you could then add those to the pivot table.

    Using your example file sheet Input
    K1: *** Sales
    L1: Commission Target
    M1: Commission
    K2: =SUMPRODUCT(--($B$2:B2=B2),--($G$2:G2=G2),($D$2:D2))
    L2: =VLOOKUP(B2,'Com Target'!$A$2:$B$7,2,FALSE)
    M2: =IF(K2>L2,(K2-L2)*0.1,0)

    Copy from K2:M2 down and this will give you the relevant commission per sale.

    HTH

    rylo

  3. #3
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    Thanks

    Had to tweak formula as follows:

    K2:=SUMPRODUCT(--($B$2:B2=B2),--($G$2:G2=G2),--($H$2:H2=H2),($D$2:D2))

    This took into account the particular quarter.

    Still got a problem tho:

    Using the above formula gives me a running total - but as soon as the total goes over the target com - Cell M is populated according to formula:

    M2: =IF(K2>L2,(K2-L2)*0.1,0)

    Then in the pivot table I get a total of the values above the target com - see attached revised worksheet.

    What I need is a way of recording the Max value found using the sumproduct formula above in the pivot table and to ignore the other values for that member of staff on a particular week.

    Regards
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    re: Add calculated item to pivot table

    Hi

    Sorry, I missed a bit.

    M3: =IF(K3>L3,(K3-L3)*0.1-SUMPRODUCT(--($B$2:B2=B3),--($G$2:G2=G3),($M$2:M2)),0)

    Copy from M3 down as required.

    rylo

  5. #5
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    Thanks Rylo

    But this has still not worked!

    This still does not erdicate the value in col M when value in col K is NOT the highest for that therapist in that week.

    Using the above formula you suggested and placing it in M3, then selecting it and using the corner handle to copy it down col M - I still get Row 17 showing that Aimee made £714.10 on 08/06/07 (week 2 of yr 07/08 Q1) and there is a value in M17 as 714.10 is above 600 - but this should be "zero", as this is not the MAX value that Aimee has earned in week 2 of Yr 07/09 Q1 - in fact her Max value was earned on Row 20 (09/06/07) - that also has a value in M20.

    The pivot table adds the values of M17 and M20 to give 24.98 - when infact her total commission for the week is value in M20 only i.e. 13.57.

    still needs more teaking - the formula:

    M17: =IF(K17>L17,(K17-L17)*0.1-SUMPRODUCT(--($B$2:B16=B17),--($G$2:G16=G17),($M$2:M16)),0)
    M20: =IF(K20>L20,(K20-L20)*0.1-SUMPRODUCT(--($B$2:B19=B20),--($G$2:G19=G20),($M$2:M19)),0)

    Are these correct?

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    re: Add calculated item to pivot table

    Hi

    Aimee's total sales for week 2 is 849.80 as shown in K20. So here commission for the week should be 24.98. If you add the values from M17 and M20, you get 24.98.

    What this formula is doing is showing in column M the commission component for each of the sales when here total sales is over the threshold. It doesn't try to find the max sales value and only apply the commission to that entry.

    As you are using a pivot table, which will add all the commissions, I didn't thing that this would be an issue.

    Your original brief wanted

    What I want to do is either have another pivot table or to add an calculated item to the weekly inc pivot table showing me how much commission each therapist took each week?
    I've taken the pivot table option which will add all the commission components and give the total commission for the therapist for the week.

    Can you check that the total commision when totaled for each week is correct?

    rylo

  7. #7
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    Dear Rylo

    You have understood my brief correctly.

    I've just re-checked all my formulas and it appears that it was my error - your formulas work - but they have now thrown up another problem - I'm getting Negative com values.

    See attached revised sheet - all negative values have been coloured red, and I've taken one of the values and highlighted it yellow and tried to work out why this happened.
    Last edited by tony0710; 06-25-2009 at 09:21 AM. Reason: deleted - by poster, as he fixed problem, but got new problem

  8. #8
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    I'm having trouble in attaching new file - saya that there is a database error - please help.

  9. #9
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    re: Add calculated item to pivot table

    Hi

    Have you tried to zip the file before attaching?


    rylo

  10. #10
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    Thanks Rylo

    Perhaps the ordinary xls file was too big - but please find attached file and hope that you can see the problem at hand.

    Thanks for any further help.
    Attached Files Attached Files
    Last edited by tony0710; 06-26-2009 at 06:18 PM.

  11. #11
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    any way of getting rid of the negative values?

  12. #12
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    re: Add calculated item to pivot table

    Hi

    Hadn't realised that you would have multiple years in the same sheet. My bad.

    Try

    =IF(K3>L3,(K3-L3)*0.1-SUMPRODUCT(--($B$2:B2=B3),--($E$2:E2=E3),--($G$2:G2=G3),($M$2:M2)),0)
    rylo

  13. #13
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    re: Add calculated item to pivot table

    Wow Thanks Rylo,

    That works a treat.

    That has resloved the original brief that I presented - but I've just been informed by my business partner that we may introduce a second target - so would like to adapt the formulaes that you have provided:

    Aimee and Bev - would get an extra £10 on reaching a weekly target of £850
    Leanne and Gemma S would get an extra £10 on reaching a weekly target of £600

    So the 10% will still remain, but an extra £10 will be given on reaching the second target.

    I think I have resloved it by following your solution above:
    • Added 2nd target column to tab "Com Target"
    • In input - added column N - to show second target according to look up:
      Please Login or Register  to view this content.
    • In input - Added Column O - to denote Grand Com (G. Com) with formula:
      Please Login or Register  to view this content.
    • Used G. Com in pivot table to show com earned.

    Is this correct? Or is there another way?

    Also, has we have not introduced the 2nd target as yet - is there a way of altering formula to take in account the date that the 2nd target will be added from? Or shall I just adjust the formulas accordingly manually?

    Not sure - whether I should be starting a new thread for this extra work - can admin please advise?

    Thanks to rylo.
    Last edited by tony0710; 07-04-2009 at 11:09 PM.

  14. #14
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Add calculated item to pivot table

    Hi

    Second one first. I'd just have the different formula from the initiaing time frame.

    Now for the hard part.

    The column O formula should be:

    =IF(AND(K2>N2,OR(B2="leanne",B2="Gemma S",B2="Bev",B2="Aimee")),M2+10,M2)
    Otherwise it will never have a match - B2 can't be leanne AND Gemma AND.....

    However, even with that fix, you will get problems. The way it stands, if you have multiple entries that are > than the threshold, then they will ALL get the additional $10. They way I read it they should only get the extra $10 once - or have I read that incorrectly???

    IF they should only get it once per week, not for every item over the threshold, then I'll have to think (that always hurts!) of some way to determine either the first or last appearance of the items and only apply to that instance. Can you clarify how many times they should be getting the extra?


    rylo

  15. #15
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    Re: Add calculated item to pivot table

    Hi Rylo

    You are right!!

    The extra £10 is only added ONCE in that week, when that target is reached.

    Am I asking for the impossible

  16. #16
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Add calculated item to pivot table

    Hi

    Try the formulas below, and do a really good test of the result. I think it is OK. I've done it from the start of the data to make sure it has enough data to do a full test.

    You will have to expand the range, but that can be worked on later.

    N2: =VLOOKUP(B2,'Com Target'!$A$2:$C$7,3,FALSE)
    O2: =IF(AND(K2>N2,OR(B2="leanne",B2="Gemma S",B2="Bev",B2="Aimee"),SUMPRODUCT(--($B$2:B2=B2),--($E$2:E2=E2),--($G$2:G2=G2))=SUMPRODUCT(--($B$2:$B$500=B2),--($E$2:$E$500=E2),--($G$2:$G$500=G2))),M2+10,M2)
    Copy down.

    This should find the last instance of the successful commission payment for the person, and add the bonus.


    rylo

  17. #17
    Forum Contributor
    Join Date
    12-27-2007
    Posts
    106

    Re: Add calculated item to pivot table

    Thanks Rylo

    That worked a treat - put it through it's paces last night - no problems - so all solved now.

    Thanks for your time and patience.

    Tony

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1