+ Reply to Thread
Results 1 to 6 of 6

Performing pivot like calculations without the use of the pivot table and parsing out list

  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    Granada Hills, CA, USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Post Performing pivot like calculations without the use of the pivot table and parsing out list

    sample.xlsx
    I am attempting to query a SQL table for items which shoes a new line for each inventory and the qty in it. I am attempting to collect the individual items and display them using one query. I am also attempting to take the list in sheet 2 and without creating a pivot table, display the list (in a new sheet if necessary) as a sum of qty's by part.
    Part Inv Qty
    1120003-015 RE 5
    1120003-015 SK 2
    2123999-100 RE 5

    to
    Part RE SK MB
    1120003-015 5 2 0
    2123999-100 5 0 0

    and how can I take a dynamic list and without using a pivot have it show by part number totals by part number ( I can get the pivot to show what I want but because of the pivot's restrictions, performing calculations with the sums gets difficult.

    Any suggestions would be appreciated and if my explanation is too vague, please let me know.
    Thanks.
    Last edited by ahunter488; 05-01-2012 at 02:14 PM. Reason: Clarifying what I am attempting to perform

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Performing pivot like calculations without the use of the pivot table and parsing out

    This can be accomplished with a cross tab query in MS Access.

    Here is the SQL statement for your example.

    Please Login or Register  to view this content.
    You can then export directly to Excel to do calculations as necessary

    Alan
    Last edited by alansidman; 04-30-2012 at 09:47 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    Granada Hills, CA, USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Performing pivot like calculations without the use of the pivot table and parsing out

    Thank you Alan. This works great for access and I can see that it does what I want, but I need a way to do this from Excel so that users without Access can perform the same calculations and that I can automate the process from one location. Can this code be applied to the sql command text in the external data connection properties definition? I attempted to adjust it, however excel did not like the transform and pivot statements, which leaves only the sum of all qty's.

    TRANSFORM Sum(InvLoc.InventoryQuantity) AS SumOfInventoryQuantity
    SELECT InvLoc.PartNo, Sum(InvLoc.InventoryQuantity) AS Total Of InventoryQuantity
    FROM InvLoc
    GROUP BY InvLoc.PartNo
    PIVOT InvLoc.InventoryLocation;

    I am using Excel 2010.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Performing pivot like calculations without the use of the pivot table and parsing out

    Quote Originally Posted by ahunter488 View Post
    I can get the pivot to show what I want but because of the pivot's restrictions, performing calculations with the sums gets difficult.
    I agree with Alan that changing the SQL is probably easier but can you explain your comment above?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Performing pivot like calculations without the use of the pivot table and parsing out

    What about changing the pivot into hard data as shown in this video. Is that an option

    http://www.datapigtechnologies.com/f...es/pivot8.html

  6. #6
    Registered User
    Join Date
    06-09-2011
    Location
    Granada Hills, CA, USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Performing pivot like calculations without the use of the pivot table and parsing out

    I think that would work great so that I can run calculations or formulas without matching up. Thank you Alan

+ 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