GROUPFIRST

Syntax

GROUPFIRST(<any>; order by any)

Description

This function returns a value in a group as specified by the ordered column's first value.

  • If the column used to order the group is a number, then the value used from the order column is the lowest number.
  • If the column used to order the group is a string, then the value used from the order column is the lowest number (in string form). If no numbers (in string form) are present, the first capital letter alphabetically is used. If no uppercase letters are present, the first lowercase letter alphabetically is used.
  • If the column used to order the group is a date, then the value used from the order column is the earliest date.

This is an aggregate function. 

Example

Given the following raw data:

Customer_numberNameOrder_numberItem
2535Jon101544Zamioculcas
2888Mike101567Spider Lily
2535Jon101643Datura
2535Jon101899Dahlia
5788Jon102003Snapdragon
2888Mike102248Marguerite
2535Jon102282Windflower
2888Mike102534Elephant's Ear
2535Jon102612Chinese Evergreen
5788Jon102617Begonia
5788Jon102765Starfish Plant
2535Jon102947Hare's Foot Fern
2535Jon103001Venus Flytrap
3545Monique103006Red Flame Ivy

Create a group, using GROUPBY(#RawData!Customer_number), and GROUPBY(#RawData!Name).

Customer_numberName
2535Jon
2888Mike
3545Monique
5788Jon

Using GROUPFIRST(#RawData!Item;#RawData!Order_number), you can return the first item ordered by each customer.

Customer_numberNameFirst_Item
2535JonZamioculcas
2888MikeSpider Lily
3545MoniqueRed Flame Ivy
5788JonSnapdragon