Prepare the maintenance dataset#
The maintenance dataset documents activity that has occurred with respect to a given Asset, organized by Part (what was repaired) and Time (when it was repaired). A Reason variable codifies the nature of the problem.
As we did for the usage dataset, we want to organize the maintenance dataset to the level of unique vehicles. For the usage dataset, we achieved this with the Group recipe. Here, we’ll use the Pivot recipe.
While the current dataset has many observations for each vehicle, we need the output dataset to be “pivoted” at the level of each vehicle; that is, transformed from narrow to wide.
As done for the usage dataset, infer storage types so that the variables Time and Quantity are no longer stored as strings.
Next, use the Pivot recipe to restructure the dataset at the level of each vehicle. In detail:
With maintenance chosen as the input dataset, choose to Pivot By Reason.
Keep the default output dataset name
maintenance_by_Reason
, and Create Recipe.At the Pivot step, select Asset as the “Row identifier”.
Reason should already be selected under Create columns with. Although it should make no difference in this case, change Pivoted values to all so that all values of Reason are pivoted into columns.
Populate content with the sum of Quantity.
Deselect “Count of records”.
Run the recipe.
The 14 distinct reasons are now spread across their own columns, with one asset per row.
Note
More detailed information on the Pivot recipe, such as how it computes the output schema, can be found in Concept | Pivot recipe.