group-ratio
pebblestream:group-ratio("Last name", "First name", ... "Amount")
All rows with the same "Last name" and "First name" are put next to each other with their "Amount" values replaced by their "Amount" value divided by their group's summed "Amount" value
When the group's sum is zero, all ratios are assigned the value of zero.
Important
Can't be used with the "group", "group-unique", or "group-sum" directives.
Consider the worksheet Deposits
First | Last | Deposit |
---|---|---|
John | Jones | 20 |
Adam | Jones | 186 |
Cathy | Albertson | 48794 |
John | Jones | 545 |
Cathy | Albertson | 8777 |
Using the following directive:
pebblestream:from(Deposits)
pebblestream:group-ratio("Last", "First", "Deposit")
derives the worksheet Ratio Deposited
First | Last | Deposit |
---|---|---|
John | Jones | 0.03539823 |
John | Jones | 0.96460177 |
Adam | Jones | 1 |
Cathy | Albertson | 0.847544771 |
Cathy | Albertson | 0.152455229 |
Updated over 2 years ago