What recipe can I use?
GSung
Registered Posts: 27 ✭✭✭✭
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.00 | 17% |
Business B | $ 20.00 | 33% |
Business C | $ 30.00 | 50% |
Total Sales | $ 60.00 |
thank you!
Answers
-
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.