How to do it…

We will need to split the data stored in LineItems into several records and, after that, split data into multiple columns.

  1. Load the following script to generate the records for each order item, and separate the product name and sale value data into two new columns. You can add this on top of the initial LOAD as a preceding LOAD:
Orders: 
LOAD
OrderID,
CustomerID,
subfield(LineItems,';',1) as ProductName,
subfield(LineItems,';',2) as Sale;
LOAD
OrderID,
CustomerID,
subfield(LineItems,'|') as LineItems;
LOAD * INLINE [
OrderID, CustomerID, LineItems
200, 1, Gloves;100|Helmet;75
201, 2, Raincoat;50|Gloves;70|Seat;90
202, 3, Seat;80
203, 4, Mudguard;90
];
  1. Go to the App overview window and open a new sheet.
  2. Enter the Edit mode by clicking on .
  3. Drag the Table object on to the screen, and add OrderID, CustomerID, and ProductName as dimensions to it. Add Sale as a measure.
  4. Promote OrderID, ProductName to the first and second column of the sorting order.
  5. The result would be as follows:
  1. As we can see, for every order there is a record for each product, and the product data is split into the ProductName and Sale columns.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset