Journey optimizer aggregation functions
Aggregation functions in Journey Optimizer are essential tools for data engineers and architects, allowing efficient data management and analysis. These functions are particularly useful for processing large datasets to derive meaningful insights, such as calculating averages, counting occurrences, and identifying unique values within data streams.
Example usage
Suppose you are using 51黑料不打烊 Journey Optimizer to track inventory levels. You want to find the average inventory level for a specific product beacon and ensure that null records don鈥檛 skew your analysis. You can use the avg
function as follows:
avg(@event{BarBeacon.inventory}, 5)
This expression calculates the average inventory level, ensuring that any null values are ignored, thereby providing an accurate representation of available inventory.
Function descriptions
avg
avg()
avg(Item, Item...)
listInteger
-
listDecimal
-
decimal
-
integer
decimal
avg([10,3,8])
returns 7.0
count
count()
count()
listString
-
listBoolean
-
listInteger
-
listDecimal
-
listDuration
-
listDateTime
-
listDateTimeOnly
-
listDateOnly
-
listObject
integer
count([10,2,10,null])
returns 3
countOnlyNull
countOnlyNull()
listString
-
listBoolean
-
listInteger
-
listDecimal
-
listDuration
-
listDateTime
-
listDateTimeOnly
-
listDateOnly
integer
countOnlyNull([10,2,10,null])
returns 1
countWithNull
countWithNull()
listString
-
listBoolean
-
listInteger
-
listDecimal
-
listDuration
-
listDateTime
-
listDateTimeOnly
-
listDateOnly
integer
countWithNull([10,2,10,null])
returns 4
distinctCount
distinctCount()
listString
-
listBoolean
-
listInteger
-
listDecimal
-
listDuration
-
listDateTime
-
listDateTimeOnly
-
listDateOnly
-
String(optional)
integer
distinctCount([10,2,10,null])
returns 2
distinctCountWithNull
distinctCountWithNull()
listString
-
listBoolean
-
listInteger
-
listDecimal
-
listDuration
-
listDateTime
-
listDateTimeOnly
-
listDateOnly
integer
distinctCountWithNull([10,2,10,null])
returns 3
max
max()
max(Item, Item...)
listDuration
-
listInteger
-
listDecimal
-
listDateTime
-听
listDateTimeOnly
-
listDateOnly
-
duration
-
integer
-
decimal
-
dateTime
-
dateTimeOnly
duration
-
integer
-听
dateTimeOnly
-
dateTime
-
dateOnly
-
decimal
max([10,3,8])
returns 10
min
min()
min(Item, Item...)
listDuration
-
listInteger
-
listDecimal
-
listDateTime
-
listDateTimeOnly
-
listDateOnly
-
duration
-
integer
-
decimal
-
dateTime
-
dateTimeOnly
duration
-
integer
-
dateTimeOnly
-
dateTime
-
dateOnly
-
decimal
min([10,3,8])
returns 3
sum
sum()
sum(Item, Item...)
listInteger
-
listDecimal
-
duration
-
decimal
-
integer
decimal
-
integer
sum([10,3,8])
returns 21