Pivot Dataset
The dataset generated by pivoting rows to columns is a dataset that is generated by performing a row-to-column operation on the original dataset.
Create Pivot Dataset
Create a new dataset. Enter the dataset page, click on "New Dataset", and select "Pivot Rows to Columns".
Click the dataset to be operated for row-to-column transformation, and the settings page appears on the right.
- Set grouping columns, aggregation columns, and transpose columns.
- Grouping Columns: Add fields from the dataset to a new dataset, allowing the addition of one or more fields.
- Aggregation Columns: The values of aggregation columns are used to populate the transposed columns. When the aggregation column is of numeric type, it supports aggregation operations such as average, sum, maximum, minimum, count, and distinct count. For non-numeric types, it supports operations such as maximum, minimum, count, and distinct count. In the example, the sum of the platform's sales quantity is used as the aggregation column.
- Transpose Columns: The fields that need to be transposed into columns. By default, the values of this field will be presented in column format. Users can customize column names. Users can add column value fields themselves.
- Add All Column Values from Transpose Columns Display all column values of the transpose column field. You can select the column values you need for conversion using the delete button, and you can also modify the alias.
- Add NULL Column Add a column with NULL values.
- Delete All Columns Delete all column information displayed in the list.
In the example, the order date is added to a new dataset, and all values in the platform column are pivoted into columns, with a custom WeChat column added. The number of pieces is used as the aggregation column to fill in the pivoted columns. Since the WeChat column does not have a value for the number of pieces, it is filled with null.
- Click to preview the transposition results to check if they meet expectations. The green box represents the grouping columns, the red box represents the transposed columns, and the blue box represents the values of the aggregated columns.
- Configure the data structure and save the dataset. Click Next to enter the data structure page. You can modify the field alias, set the field to display or hide, and then save the dataset.
Instructions
- The columns of the row-to-column dataset are divided into two parts: one part is the original columns from the data, i.e., the fields added in the grouping columns, and the other part is the new columns generated by the row-to-column transformation.