+ Reply to Thread
Results 1 to 3 of 3

pivot table - second record - from SQL server

  1. #1
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    17

    pivot table - second record - from SQL server

    Hello together,

    could anybody help me - I need to select pivot table where will be for each CUSTOMER the second ORDER ordered by DATE.

    Data would be

    CUSTOMER ORDER QUANTITY DATE
    A 1 100 5.1.2021
    A 2 200 5.3.2021
    A 3 100 5.5.2021
    A 4 200 5.7.2021
    A 5 100 5.9.2021
    C 10 100 14.1.2021
    C 20 200 14.3.2021
    C 30 100 14.5.2021


    Result should be

    CUSTOMER ORDER QUANTITY DATE
    A 2 200 5.3.2021
    C 20 200 14.3.2021


    Is it possible?

    Thank You!

    Martin
    Last edited by MartyZ; 04-07-2021 at 09:33 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    5,890

    Re: pivot table - second record - from SQL server

    One way would be to bring the data in using Power Query/Get and Transform, sort the data by customer and date, add an index column, then calculate the minimum index number for each customer in a separate group query, add 1, then use that as a merge query to filter the original data.
    Rory
    I drink, and I know things

  3. #3
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    17

    Re: pivot table - second record - from SQL server

    super idea, thanx a lot

    Martin

+ 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. problem with data in pivot table from sql server
    By MartyZ in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-25-2020, 03:56 AM
  2. Excel Pivot Table from SQL Server cannot show non-aggregate
    By supremesabre in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2018, 04:45 AM
  3. Pivot Table, use VBA to get use back to record in source data table
    By gr8tday in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2014, 01:30 AM
  4. Using Pivot table data outside of an SQL Server machine
    By moty.98 in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 06-03-2013, 05:32 AM
  5. Number of rows that a pivot table can read from SQL Server
    By tomahawk86 in forum Excel General
    Replies: 1
    Last Post: 06-04-2012, 10:35 AM
  6. Refresh Pivot Table SQL Server
    By MatthewOwens in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-23-2009, 09:54 PM
  7. [SOLVED] Pivot Table based on SQL Server query
    By Ben Rum in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2005, 07:26 AM

Tags for this Thread

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