I have a table of data which is in an awkward format which I'm trying to simplify using Power Query. I'm not very well versed in Power Query so I'm probably missing something obvious here, so I'm hoping you can help! The table of data is in a format like this:
And I want to end up with a simplified table of data like this:
The issue is that the Header row in the first table is actually 2 rows, split by Activity Number and Activity Name:
So when I end up using the Power Query (and filtering the output) the output is this:
But I'd like to obtain the Activity Name as well. Once I Close & Load from the Power Query I can apply an HLOOKUP formula in the output to pull the Activity Name, but if I refresh the Power Query then this manual change gets removed. Is there a way that I can pull in the Activity Name directly from the source data table as part of the Power Query as well?
ID Number 1 | ID Number 2 | Status | Start Date | 1 Activity 1 | 2 Activity 2 | 3 Activity 3 | 4 Activity 4 | 5 Activity 5 | 6 Activity 6 |
---|---|---|---|---|---|---|---|---|---|
12345 | 1 | Active | 14-Feb-19 | 300 | 250 | ||||
12345 | 2 | Active | 11-May-20 | 160 | 80 | 130 | |||
12345 | 3 | Completed | 3-Jun-20 | 220 | 40 | ||||
67890 | 1 | Active | 6-Sep-19 | 175 | 350 | 125 | |||
67890 | 2 | Active | 11-Nov-19 | 90 | |||||
67890 | 3 | Cancelled | 6-Apr-20 | 210 | |||||
67890 | 4 | Active | 9-May-20 | 110 | |||||
67890 | 5 | Active | 22Feb-21- | 200 | |||||
67890 | 6 | Completed | 6-Aug-21 | 105 | 265 | 110 |
And I want to end up with a simplified table of data like this:
ID Number 1 | ID Number 2 | Status | Start Date | Activity Number | Activity Name | Cost |
---|---|---|---|---|---|---|
12345 | 1 | Active | 14-Feb-19 | 1 | Activity Name 1 | 300 |
12345 | 1 | Active | 14-Feb-19 | 3 | Activity Name 3 | 250 |
12345 | 2 | Active | 11-May-20 | 2 | Activity Name 2 | 160 |
12345 | 2 | Active | 11-May-20 | 5 | Activity Name 5 | 80 |
12345 | 2 | Active | 11-May-20 | 6 | Activity Name 6 | 130 |
12345 | 3 | Completed | 03-Jun-20 | 1 | Activity Name 1 | 220 |
12345 | 3 | Completed | 03-Jun-20 | 4 | Activity Name 4 | 40 |
67890 | 1 | Active | 06-Sep-19 | 1 | Activity Name 1 | 175 |
67890 | 1 | Active | 06-Sep-19 | 3 | Activity Name 3 | 350 |
67890 | 1 | Active | 06-Sep-19 | 6 | Activity Name 6 | 125 |
67890 | 2 | Active | 11-Nov-19 | 4 | Activity Name 4 | 90 |
67890 | 3 | Completed | 06-Apr-20 | 2 | Activity Name 2 | 210 |
67890 | 4 | Active | 09-May-20 | 4 | Activity Name 4 | 110 |
67890 | 5 | Active | 22-Feb-21 | 1 | Activity Name 1 | 200 |
67890 | 6 | Completed | 06-Aug-21 | 2 | Activity Name 2 | 105 |
67890 | 6 | Completed | 06-Aug-21 | 3 | Activity Name 3 | 265 |
67890 | 6 | Completed | 06-Aug-21 | 5 | Activity Name 5 | 110 |
The issue is that the Header row in the first table is actually 2 rows, split by Activity Number and Activity Name:
ID Number 1 | ID Number 2 | Status | Start Date | 1 | 2 | 3 | 4 | 5 | 6 |
Activity Name 1 | Activity Name 2 | Activity Name 3 | Activity Name 4 | Activity Name 5 | Activity Name 6 |
So when I end up using the Power Query (and filtering the output) the output is this:
ID Number 1 | ID Number 2 | Status | Start Date | Activity Number | Cost |
---|---|---|---|---|---|
12345 | 1 | Active | 14-Feb-19 | 1 | 300 |
12345 | 1 | Active | 14-Feb-19 | 3 | 250 |
12345 | 2 | Active | 11-May-20 | 2 | 160 |
12345 | 2 | Active | 11-May-20 | 5 | 80 |
12345 | 2 | Active | 11-May-20 | 6 | 130 |
12345 | 3 | Completed | 03-Jun-20 | 1 | 220 |
12345 | 3 | Completed | 03-Jun-20 | 4 | 40 |
67890 | 1 | Active | 06-Sep-19 | 1 | 175 |
67890 | 1 | Active | 06-Sep-19 | 3 | 350 |
67890 | 1 | Active | 06-Sep-19 | 6 | 125 |
67890 | 2 | Active | 11-Nov-19 | 4 | 90 |
67890 | 3 | Completed | 06-Apr-20 | 2 | 210 |
67890 | 4 | Active | 09-May-20 | 4 | 110 |
67890 | 5 | Active | 22-Feb-21 | 1 | 200 |
67890 | 6 | Completed | 06-Aug-21 | 2 | 105 |
67890 | 6 | Completed | 06-Aug-21 | 3 | 265 |
67980 | 6 | Completed | 6-Aug-21 | 5 | 110 |
But I'd like to obtain the Activity Name as well. Once I Close & Load from the Power Query I can apply an HLOOKUP formula in the output to pull the Activity Name, but if I refresh the Power Query then this manual change gets removed. Is there a way that I can pull in the Activity Name directly from the source data table as part of the Power Query as well?