0

I'm new to Dataprep and now trying to create a pivot table using the "Pivot Transform" https://cloud.google.com/dataprep/docs/html/Pivot-Transform_57344645#example---basic-pivot

I searched the documents and the syntax looks simple enough, except for the fact that it is out of context and not sure where to use it. syntax is : pivot col: (the parameter to be used as col) value: (value to present) group: (what to group by)

Other solutions that I found here and elsewhere all require lots of code and heavily rely on knowing the columns in advance e.g : using case when ____ = 'name of col' to pivot the data

any idea will be appreciated

Guillem Xercavins
  • 6,938
  • 1
  • 16
  • 35
Amit Sadeh
  • 41
  • 4

1 Answers1

0

I'll assume that you have already imported the dataset with the data and then you created a new flow. When you add the dataset to the flow you can then add a recipe. You can find details on how to do so in the quickstart.

Regarding, the pivot transform, once you have added the recipe click on the Recipe button on top and then select Add New Step as depicted here:

enter image description here

Then, in the Transformation text box you can start typing pivot and select the Pivot transform as seen below. A menu will appear and you can apply the parameters using the UI.

enter image description here

Otherwise, you can just copy and paste the formula in the text box. For example:

pivot col:Date value:SUM(Sales) group:State

And the fields will be filled in and you can check the preview of the pivot transform:

enter image description here

Guillem Xercavins
  • 6,938
  • 1
  • 16
  • 35