What recipe can I use?

GSung
Level 3
What recipe can I use?

Hi

I have used the group recipe to create the below table , from a large dataset.

 Total Sales
Business A $                             10.00
Business B $                             20.00
Business C $                             30.00

 

From this table, what recipe & steps can I use to create the additional calculation (below highlighted in red?)

 

 Total Sales%
Business A $                             10.0017%
Business B $                             20.0033%
Business C $                             30.0050%
Total Sales $                             60.00 

 

thank you!

0 Kudos
1 Reply
fchataigner2
Dataiker

Hi,

the percentage column can easily be created with a Window recipe: a window recipe can compute for each row the sum of the "total sales" for some grouping of the columns, and from there a percentage is only the matter of computing a ratio.

But no recipe can give a straightforward way to add the "total sales" row. A naive way would be to use a Group recipe to compute the sum, some Prepare recipe to rename columns and put the 'total sales' name in a cell for the "business name" column, followed by a Stack recipe to merge the 2 datasets.

0 Kudos