+ Reply to Thread
Results 1 to 4 of 4

How to create pivot table with multiple headers in power query

  1. #1
    Registered User
    Join Date
    03-02-2021
    Location
    Hong Kong
    MS-Off Ver
    MS 2013
    Posts
    2

    How to create pivot table with multiple headers in power query

    Hi,

    I have a problem to create pivot table with multiple headers in power query,

    here is my base data:
    base data.JPG

    And, here is my expected output:
    expected output.JPG


    How can i generate the expected output? Thanks a lot!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,935

    Re: How to create pivot table with multiple headers in power query

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-02-2021
    Location
    Hong Kong
    MS-Off Ver
    MS 2013
    Posts
    2

    Re: How to create pivot table with multiple headers in power query

    Attached please find the sample test data.

    Hope someone may help me.

    Thanks a lot.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: How to create pivot table with multiple headers in power query

    Perhaps someone can simplify this:
    1. Add two columns (J:K) to the source data to record times as text using: =IF(ISNUMBER([@[Late In]]),TEXT([@[Late In]],"hh:mm:ss"),[@[Late In]])
    Note that the column headers for columns J:K have an extra space at the end to distinguish them from columns H:I
    2. Use the following Power Query advanced editor code:
    Please Login or Register  to view this content.
    3. Select Close & Load to: then select Connection only and Add to Data Model
    4. In the Data Model add the following measure: Value Results:=CONCATENATEX(Table1,[Value])
    Note that the table produced by Power Query is called Table1 and that the default name for the column is Value. Either or both could be changed.
    Note that the measure name, Value Results, could also be changed.
    5. Produce a pivot table from the Data Model using Call in Sign in the Rows area, Date and Attribute (Shift, Late In, Early Out) in the Columns area and the measure Value Results in the Values area.
    Note that the Shift column may need to be manually moved ahead of Late In and Early Out. Also Late In moved in front of Early Out. When this is done for one date the others should change automatically.
    Here is a link to an article that may help: https://sfmagazine.com/post-entry/ju...a-pivot-table/
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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. [SOLVED] Power Query and imported table headers
    By Tresfjording in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2019, 06:38 PM
  2. Replies: 1
    Last Post: 11-12-2018, 02:46 PM
  3. Power Query and Power Pivot Table
    By haitham.shop in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-06-2018, 06:17 AM
  4. Power Query and Power Pivot Table !!
    By haitham.shop in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2018, 06:15 AM
  5. POWER Query and Power Pivot Table !!
    By haitham.shop in forum Access Tables & Databases
    Replies: 0
    Last Post: 08-06-2018, 05:59 AM
  6. Replies: 5
    Last Post: 06-29-2018, 05:35 AM
  7. Power Pivot table headers changes color when refreshed
    By Sgligori in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 05-19-2015, 03:56 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