+ Reply to Thread
Results 1 to 17 of 17

Transpose table in Power Query multiple date columns

  1. #1
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Transpose table in Power Query multiple date columns

    Dear Experts,

    I am trying to transpose the report to correct the data table, in google searching I found a solution as below steps I followed but I stuck here due to I am new to Power query. need your help with steps I missed or did something incorrect.

    First I used TEXTJOIN to join the Depart name and headers with delimiter (semicolon)
    Removed top 1 row
    Use first row as headers
    Select the first 3 columns
    Unpivot other columns (dropdown menu unpivot columns on Transform Tab)
    Select [Attribute] column
    Split column by delimiter (Semicolon)
    but the result is not shown as I required, also the date format is not set. I think I am missing some steps, If someone can help me in this please will appreciate to write down the missing steps as I have 2, 3 more reports that I will correct the reports view by Power query as I found it easy to use.

    Please also 0/blank values are not required to show in the power query report.

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-01-2011
    Location
    India
    MS-Off Ver
    Microsoft 365
    Posts
    33

    Lightbulb Re: Transpose table in Power Query multiple date columns

    Depending on the data and requirements we can not Unpivot the items. As per my knowledge I have created separate table for each department and then combined all in the end.

    However, I could not populate the rejection column, instead the quantity is available in the row.

    Main Data format as per requirement

    Please Login or Register  to view this content.
    Cutting Batch 1

    Please Login or Register  to view this content.
    Cutting Batch 2

    Please Login or Register  to view this content.
    Stitching Batch 1
    Please Login or Register  to view this content.
    Stitching Batch 2
    Please Login or Register  to view this content.
    Stitching Batch 3
    Please Login or Register  to view this content.
    Finishing Batch 1
    Please Login or Register  to view this content.
    Finishing Batch 2
    Please Login or Register  to view this content.
    Rejections

    Please Login or Register  to view this content.
    Combining all the tables again
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Thank you so much @vinitdhuri for your help, really appreciated, when I add more columns of Date and Qty, power query did not get these on refreshing in original file there's many columns of date and qty in each department.

    Also in required tab I wished Rejection to be in header. may be a way in power query from which we can do this in single code. I will wait if someone other expert can help in more simple way. It will learning for me also to correct the other reports like this one.

    Thank you so much

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

    Re: Transpose table in Power Query multiple date columns

    This proposal applies formulas to the query table on the PQ sheet to get the required output.
    For the Order:Date columns:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For the Qty column:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For the Rejection column:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that zeros have been placed in cells W7 and W10 of the Original Report sheet to make this work.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    @JeteMc It is so great, simply WOW! you did it by formulas so nice of you and Thank You so much for your precious help and time. you solved this problem with formula. I will implement it on my actual report.

    But actually I am looking for someone expert to help in the power query report to be correct, which I refresh and power query extract all the Original Report tab data and place in the power query report. because I have a huge data and it will updated continue.., with formulas my file will become huge I think?

    Also (power query report) it will be learning for me and also for others if someone is stuck in problem like this.
    (My request to move my post to the correct section of power query if I posted in the wrong section)

    @JeteMc Thank you so much once again.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Transpose table in Power Query multiple date columns

    How does the original report actually come to you? I assume not exactly in the format shown in your sample.
    Rory

  7. #7
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Hi Rory, Thank you for your time.

    1. This is daily entry report department wise. every day received some quantity of specific order which enters in the same row but with the received date.
    like below. I only add 3 date and qty columns in each department but in my actual report there's more columns of date and qty in each department. (I merged the starting columns headers only for better understanding, in actual these are not merged, these are in one row.

    Image20230719144208.png

    The result file of @JeteMc is perfect but I need to know the power query process for this report transformation.

    also I have 2 other reports like this but if this one is corrected then I will follow the same process for other 2 reports to correct them.

    I think its more clearer. if not please ask me I will describe more to understand easily. I really don't want to waste my expert's precious time.

    Thank You.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Transpose table in Power Query multiple date columns

    What I would like is a copy of the starting report (in a workbook) before you add any headers or merge any cells so that we can see if the whole thing can be automated in PQ, or the least manual intervention required.

  9. #9
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Originally this is manual entry report, we received on manual paper from cutting/stitching/finishing. that which order number production is how much yesterday and we enter the data in this manual excel report in front of the specific order, this report is manually designed in excel sheet and continued since 2018 till now. but now I am trying to automat this report and if possible to give a good look also to create a dashboard which is not possible from this horizontal report.

    Like I have a Order# 1

    Cutting produced 18/07/2023 100 EA Stitching produced 18/07/2023 50 EA Finishing produced 18/07/2023 100 EA



    and we have columns 30 for Date and Qty in each department (Cutting & Stitching & Finishing) may be some orders complete in 10 Days some 15 or 20 Days. so every day production enters in this. and the starting A to H columns will show the details that what is order number/style number/color and what is the price for this order and what is total quantity.

    what I wish to> when I enter data in the horizontal report daily and I refresh the PQ tab report so the date wise departmental report presented that in which date how much production of which department.

    1. All date columns combine
    2. All department wise quantity present in the front of date.

    May be the above can help. attached again the blank sample file and below the requirement (PQ table).
    Attached Files Attached Files

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Transpose table in Power Query multiple date columns

    OK, and does the dashboard need to be in the same workbook?

    Also, can you rename the headers in the template to be Cutting Date1, Cutting Qty1, Cutting Date2, Cutting Qty2 and so on, up to 30 for each department?
    Last edited by rorya; 07-19-2023 at 10:16 AM.

  11. #11
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Yes in same workbook if the workbook MB's not gone huge.

    Yes its possible to rename the headers as you describe. if it makes some easiness you may please proceed to rename in sample file.

    Thanks

  12. #12
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Transpose table in Power Query multiple date columns

    That should make it much easier then - see attached example. The M code is just:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Wow!!!! Rory You are great Thank you Sooooooo muchhhh..

    one problem I notice, the rejection quantity is showing with every row, this should be only with the last finishing date. otherwise the rejection quantity will increase just like 7 quantity is reject but the report show 42 total. can you please check this.

    Thank You so much once again

  14. #14
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Transpose table in Power Query multiple date columns

    This can be streamlined but shows the calculation steps:

    Please Login or Register  to view this content.
    I also added some sorting and type conversion.

  15. #15
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Rory I am at a loss for words to praise you, but you have solved one of my huge problem. Thank you from the bottom of my heart. Great help Thank You soooo muchhh.

    I will request 1 thing please when you have time, I am not that good at understanding M Code. Can you please write the steps for us to understand or a gif file so that everyone can understand what you did in power query tab. example like below.

    Removed top 1 row
    Use first row as headers
    Select the first 3 columns
    Unpivot other columns (dropdown menu unpivot columns on Transform Tab)
    Select [Attribute] column
    Split column by delimiter (Semicolon)
    Thank You so much once again and again.
    Last edited by Waqas Gul; 07-20-2023 at 12:56 AM.

  16. #16
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Transpose table in Power Query multiple date columns

    Does this help?

    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    01-09-2019
    Location
    Karachi, Pakistan
    MS-Off Ver
    MS 365
    Posts
    124

    Re: Transpose table in Power Query multiple date columns

    Great, Rory, Thank You so much

+ 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] How to filter 0 from two columns in power query editor in one step?
    By daliye in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2023, 09:44 PM
  2. Replies: 4
    Last Post: 07-04-2023, 10:36 AM
  3. Power query Date Table function
    By Dicken in forum Office 365
    Replies: 7
    Last Post: 11-10-2022, 12:53 PM
  4. [SOLVED] Trying to create Date Table in power query using M
    By Dicken in forum Office 365
    Replies: 3
    Last Post: 11-11-2021, 10:21 AM
  5. Power Query - Transpose Specific Columns
    By keith6292 in forum Excel General
    Replies: 1
    Last Post: 07-20-2021, 04:01 PM
  6. [SOLVED] Data from multiple columns into one table by date query
    By MattExcelLearner in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-26-2020, 07:15 AM
  7. [SOLVED] Transpose from columns to rows with Power Query
    By lofgren in forum Excel General
    Replies: 9
    Last Post: 06-21-2020, 10:56 AM

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