Transpose raw data into multi-line calendar format in PowerQuery

wunderfitz

New Member
Joined
Sep 20, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

I've scoured the web and YouTube, and often found solutions that were quite close to what I'm trying to do, but not close enough. Maybe someone here has an idea...

I'm trying to use PowerQuery to compile various data sources into a single table with raw data for customer work orders for appr. 10000 customers.
I then want to transpose it into an Excel Table (as opposed to an Excel range) in a calendar view, so that
- a customer can have 0, 1 or multiple contracts
- a contract can have 1 or more work orders
- work orders can span multiple months or multiple work orders can occur in one month (i.e. weekly or biweekly work orders)

The raw data initially looks something like this:
Customer 01Contract 01-astart: jan 1st 2022 / end: jan 31st 2022Work Order 01-a-01
Customer 01Contract 01-astart: feb 1st 2022 / end: feb 28th 2022Work Order 01-a-02
Customer 01Contract 01-astart: mar 1st 2022 / end: mar 31st 2022Work Order 01-a-03
Customer 01Contract 01-bstart: apr 1st 2022 / end: jun 31st 2022Work Order 01-b-04
Customer 02Contract 02-astart: jan 1st 2022 / end: jan 31st 2022Work Order 02-a-01 (1 of 2)
Customer 02Contract 02-astart: jan 1st 2022 / end: jan 31st 2022Work Order 02-a-02 (2 of 2)
Customer 02Contract 02-astart: feb 1st 2022 / end: feb 28th 2022Work Order 02-a-03 (1 of 2)
Customer 02Contract 02-astart: feb 1st 2022 / end: feb 28th 2022Work Order 02-a-04 (2 of 2)
Customer 02Contract 02-astart: mar 1st 2022 / end: mar 31st 2022Work Order 02-a-05 (1 of 2)
Customer 02Contract 02-astart: mar 1st 2022 / end: mar 31st 2022Work Order 02-a-06 (2 of 2)
Customer 03no contract----
............


and I'd like to display it like this:
CustomerContractJanFebMarAprMayJun...
Customer 01Contract aWork Order 01-a-01Work Order 01-a-02Work Order 01-a-03...
Customer 01Contract bWork Order 01-b-04Work Order 01-b-04Work Order 01-b-04...
Customer 02Contract aWork Order 02-a-01Work Order 02-a-03Work Order 02-a-05...
Customer 02Contract aWork Order 02-a-02Work Order 02-a-04Work Order 02-a-06...
Customer 03no contract------------...
...........................

I'm actually quite close, in that I can generate one line of data for every customer-contract-workorder-month combination, I can even transpose and group the data, so that any customer-contract combination is on a separate line, but I fail miserably when it comes to ending up with n lines when there are n work orders for each month, where n can be between 1 and 9.

I have already tried "grouping" in PowerQuery, using the option to not aggregate, but that will result in a bunch of subtables which I am not sure how to fit into the calendar.

I also do not want the results to be staggered, i.e.
CustomerJanFeb
Customer 01Contract aWO 1
Customer 01Contract aWO n
Customer 01Contract aWO n+1
Customer 01Contract aWO n+n


but would instead prefer
CustomerJanFeb
Customer 01Contract aWO 1WO n+1
Customer 01Contract aWO nWO n+n
Customer 01Contract aWO 03
Customer 01Contract aWO 04
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
... ignore the last 2 lines of that table - the editor would not let me...

i.e. I want to have achieve a calendar that is as compact as possible without aggregating the detail data, but instead distributing it over all 12 months and - if necessary - over multiple lines.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top