combine multiple date columns with value into single date and value columns

Anonymous
2020-01-16T15:41:35+00:00

I'm struggling to wrangle my data

I have a selection of data that:

  • Has multiple columns, each with a specific date as a header
  • Has value in each date column cells
  • I have row headers, representing product type
  • I have row sub-headers, representing territory

I would like:

  • A single column with the date
  • A single column with the related values, per date
  • A single column with the product type
  • A single Column with Territory

Is this possible?

Below is an example of what the raw data would look like:

What I am trying to achieve:

I hope there is an excel wizard who can help with this query.

Joe

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Lz._ 38,106 Reputation points Volunteer Moderator
    2020-01-17T11:01:31+00:00

    Joe,

    Difficult to say with the picture you posted and I understand you cannot share sensitive data, although you could easily put together a sample with dummy data, that would not take more than 10 mins, keep this is mind in the following doesn't help

    1st of all, you've probably observed I rename almost all APPLIED STEPS created with the UI. Simple reason is I hate reading i.e. #"Grouped Rows"

    So you can follow I don't do that below:

    #1 Once you've referenced your data Table to build your Result query, in PQ you see something like

    #2 Select columns [Product Type] and [Territory] > Go to Transform tab > click the little arrow down icon next to Unpivot Columns > choose Unpivot Other Columns. You should get:

    you see that by default unpivoted columns are named [Attribute] and [Value]. That's where I "cleverly" made a modif. At the end we want a [Date] column. So we could continue the default [Attribute] column name but then we would need an additional Step at the end to rename that column => [Date]. To prevent this, just edit the Step in the formula bar and change the string "Attribute" with… "Date" :

    #3 Select  column [Date] > in the Transform tab, next to Data Type, select Date in the list:

    #4 Select columns [Product Type], [Territory] and [Date] > Right-click > Group By… use the following:

    OK ==> Done!!!

    6 people found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Lz._ 38,106 Reputation points Volunteer Moderator
    2020-01-16T16:54:07+00:00

    Hi Joe

    The wizard is called Get & Transform (aka Power Query)

    Data in Table1

    Query output

    Could you play with the corresponding sample (download it) to check this does what you want, I'll explain later (no worries, very easy)

    Any question let me know

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Anonymous
    2020-01-17T08:39:09+00:00

    Hi Lz,

    this is amazing.

    When you have a chance, please show me the magic behind the curtain (wizard of Oz reference).

    Joe

    0 comments No comments
  4. Lz._ 38,106 Reputation points Volunteer Moderator
    2020-01-17T09:02:24+00:00

    please show me the magic behind the curtain (wizard of Oz reference). ;-)

    Hi Joe

    Can you live with the sample I provided or do you want me to explain How To reproduce it on your end?

    If you can live with it then please Mark as answer my previous reply (can help others…) - Thank in advance

    Otherwise I will explain but it'll take me some time to doc. Again, it's not difficult but there's one thing that is a little bit tricky as we don't necessarily know (in your case) how many Date columns we have

    0 comments No comments