You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Syntax |`mode({s: EventPropertyExtractor}, {d: Integer})`<br>`s` - the property to find the most frequent value of<br>`d` - minimum frequency expected |
157
-
| Return Type |`Scalar`|
158
-
| Description | Find the most frequent value for a given property name. |
| Syntax |`max({s: EventPropertyExtractor})` or `max({s: EventPropertyExtractor} as type)`<br>`s` - property to get the maximum value of <br>`type` - number, string |
146
+
| Return Type |`Scalar`|
147
+
| Notes | If no type is passed, Segment assumes `number` as the `type` and selects the greatest value. You can override the behavior to select the max based on lexicographical ordering by specifying `as string`. |
148
+
| Example |`max(property('spend'))`<br>`max(property('spend') as string)`|
| Syntax |`min({s: EventPropertyExtractor})` or `min({s: EventPropertyExtractor} as type)`<br>`s` - property to get the minimum value of <br>`type` - number, string |
153
+
| Return Type | `Scalar`
154
+
|
155
+
| Notes | If no type is passed, Segment assumes `number` as the `type` and selects the smallest value. You can override the behavior to select the max based on lexicographical ordering by specifying `as string`. |
156
+
| Example |`min(property('spend'))`<br>`min(property('spend') as string)`|
| Syntax |`mode({s: EventPropertyExtractor}, {d: Integer})` or `mode({s: EventPropertyExtractor} as type, {d: Integer})`<br>`s` - the property to find the most frequent value of <br>`d` - minimum frequency expected <br>`type` - number, string, array |
161
+
| Return Type |`Scalar`|
162
+
| Description | Find the most frequent value for a given property name. |
163
+
| Notes | If no type is passed, Segment assumes `string` as the `type` and selects the most frequent value assuming all data is a string. `number` will behave the same as `string`. `array` will also behave the same way, except when used in combination with the `$` operator where instead of treating each individual value within the array separately Segment will instead treat the whole array as a string. |
164
+
| Example |`mode(property('spend'), 2)`<br>`mode(property('spend') as array, 2)`|
| Description | Represents the date range between today and the past `d` days - inclusive where today represents the current date at the time Segment determines audience membership or calculates the trait. |
| Description | Represents the date range between today and the next `d` days - inclusive where today represents the current date at the time Segment determines audience membership or calculates the trait. |
| Description | Represents the date range between today - `d` days and any past date prior to that - inclusive where today represents the current date at the time Segment determines audience membership or calculates the trait. |
| Description | Represents the date range between today + `d` days and any future date - inclusive where today represents the current date at the time Segment determines audience membership or calculates the trait. |
This example calculates the most frequent spend value for each user, based on all `Shoes Bought` events performed within the last 30 days. It only considers spend values that have a minimum frequency of `2`:
0 commit comments