+ Reply to Thread
Results 1 to 18 of 18

Variance Column as Part Of Pivot

  1. #1
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Variance Column as Part Of Pivot

    Hi All

    I am importing data into excel from a sql table and then creating a pivot based on this data (SEE BELOW EXAMPLE). I have created a manual column which adds the tonnage for each week and then subtract the budget from this total (to give the variance).

    This works fine until for example we come into the new month which may have 5 weeks (as opposed to 4 in the previous month), which in turn means an extra column. The extra column then overwrites the variance column. Is there anyway I can get the variance to be built into the pivot? Please see below example:

    REP Budget Late 2017-12-11 2017-12-18 2017-12-25 Invoiced Variance
    XX 100 10 10 10 10 -60
    YY 200 20 20 20 20 20 -100

    Thanks In Advance

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Thank you for your response, I have added an example.
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    This is pretty straightforward by using PowerPivot, and adding a few Measures to the Data Model. Add your source data to the data model (in this case, as 'Table1' ), and add the following measures:

    Actual Value:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Budget Value:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Potential Value:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Variance:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Then you can construct a pivot table with Actual Value, Potential Value and Variance as values.

    See attachment for worked example.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Exactly what I wanted and will click on the enhance reputation, only issue is we have 365 business version and having had a look online, this add-in is not available on this version!

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Ah, that's a bugger! Get a proper version

  7. #7
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Sorry - re-opened this... I now have the version with power pivot and the above has really helped create additional reports. What I don't understand and apologies if this is really simple, in the above example there is simple one column in the pivot table which shows the total for potential. I am not sure how this has been placed in the pivot.

    I have created the measures in my report, however get a figure for potential for each monthly status as opposed to a total of potential as in above solution. How did you get this?

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Rearrange your column fields, so that [∑ Values] is above [clc_monthly_status]


  9. #9
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Hi I did try that but I also get a grand total for Actuals Value

    Actuals Value Total Actuals Value Total Potential Value Total Variance Value
    Budget Late Invoiced 2018-02-05 2018-02-12 2018-02-19 2018-02-26

  10. #10
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Turn off Grand Totals For Rows

  11. #11
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Apologies and thank you ever so much for your time. I have turned off grand totals for rows but this also gets rid off the potential and variance columns as well as the Total Actuals.

    Sorry

  12. #12
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Look at how I created the measures / layout in the example file.

    If you're still struggling, then attach your workbook.

  13. #13
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Not trying to be lazy - honest! I did create the measures like yourself, but I don't know how to get the variance and potential like you did, really appreciate your assistance - thanks ever so much.
    Attached Files Attached Files

  14. #14
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Your [Actuals] and [Budget Value] measures are incorrect. Look at what I posted in #4. The BLANK() values are important, to return values only in your required evaluation context.

  15. #15
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    Reverted back to original formulas (although there will be times when there is only one value for shortfall status and this wont show the totals correctly), removed totals for rows and potential and variance columns are disappearing as per above.

  16. #16
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    The file you attached had errors in the measures (you replaced BLANK() with other calculations, you used HASONEFILTER instead of HASONEVALUE...)

    I'm not sure what more help I can provide - I have showed you the measures you need to use, and an example file showing the pivot layout which works, to give the result you want.

  17. #17
    Registered User
    Join Date
    12-11-2017
    Location
    LEEDS,ENGLAND
    MS-Off Ver
    2016
    Posts
    15

    Re: Variance Column as Part Of Pivot

    I totally agree, tried recreating the pivot again, copying the formulas you provided for actuals value, budget and potential, but they only way potential value is showing is if I have row totals on, but this then shows total for actuals which is not what your example is showing (which incidentally is exactly what I want.. I am confused will try to figure it out, but thank you ever so much for your time.

  18. #18
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Variance Column as Part Of Pivot

    Quote Originally Posted by AMJADJ View Post
    I totally agree, tried recreating the pivot again, copying the formulas you provided for actuals value, budget and potential, but they only way potential value is showing is if I have row totals on, but this then shows total for actuals which is not what your example is showing (which incidentally is exactly what I want.. I am confused will try to figure it out, but thank you ever so much for your time.
    The total for Actuals won't show, if you use the Measure I gave you:
    Please Login or Register  to view this content.
    This measure returns BLANK when there are multiple values for 'status', so the Total Actual column will be suppressed.


    You could use ISFILTERED instead of HASONEVALUE, to deal with occasions where there is only one 'status' value in your source data - but in that case, the whole premise of Potential / Variance is pretty much irrelevant anyway....
    Last edited by Olly; 02-12-2018 at 10:01 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pivot with part of the column data
    By nagesh.tvsr in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-07-2017, 07:53 AM
  2. Variance in Pivot Table
    By rizmomin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-25-2017, 09:55 PM
  3. day on day variance comparison using pivot table
    By yelllowsubmarine in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2015, 09:44 PM
  4. [SOLVED] Find the date of a variance amount over a limit and count the days since the variance.
    By avidcat in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 06-21-2013, 12:00 PM
  5. Pivot Table - Variance Row?
    By davidskg in forum Excel General
    Replies: 0
    Last Post: 02-01-2012, 02:18 PM
  6. [SOLVED] Pivot Tables - Variance and Variance %
    By PJS in forum Excel General
    Replies: 2
    Last Post: 01-17-2006, 11:15 PM
  7. [SOLVED] Pivot Tables - Variance and % Variance fields
    By CraigS in forum Excel General
    Replies: 5
    Last Post: 01-05-2005, 09:06 PM

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