GROUPLAST
Syntax
GROUPLAST(<any>; order by any)
Description
This function returns a value in a group as specified by the ordered column's last value.
If the column used to order the group is a number, then the value used from the order column is the highest number.
If the column used to order the group is a string, then the value used from the order column is a lowercase letter starting with z and moving reverse alphabetically followed by uppercase letters reverse alphabetically. If no letters are present in the sting type, the value used is the highest number.
If the column used to order the group is a date, then the value used from the order column is the latest date.
This is an aggregate function.
Example
Given the following data:
Customer_ | Name | Order | Item |
|---|---|---|---|
2535 | Jon | 101544 | Zamioculcas |
2888 | Mike | 101567 | Spider Lily |
2535 | Jon | 101643 | Datura |
2535 | Jon | 101899 | Dahlia |
5788 | Jon | 102003 | Snapdragon |
2888 | Mike | 102248 | Marguerite |
2535 | Jon | 102282 | Windflower |
2888 | Mike | 102534 | Elephant's Ear |
2535 | Jon | 102612 | Chinese Evergreen |
5788 | Jon | 102617 | Begonia |
5788 | Jon | 102765 | Starfish Plant |
2535 | Jon | 102947 | Hare's Foot Fern |
2535 | Jon | 103001 | Venus Flytrap |
3545 | Monique | 103006 | Red Flame Ivy |
First create a group using GROUPBY(#RawData!Customer_), and GROUPBY(#RawData!Name).
Customer_ | Name |
|---|---|
2535 | Jon |
2888 | Mike |
3545 | Monique |
5788 | Jon |
Using GROUPLAST(#RawData!Item;#RawData!Order), you can return the last item ordered by each customer.
Customer_ | Name | Last_Item |
|---|---|---|
2535 | Jon | Venus Flytrap |
2888 | Mike | Elephant's Ear |
3545 | Monique | Red Flame Ivy |
5788 | Jon | Starfish Plant |