Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
argMinIf
Description
TheIf combinator can be applied to the argMin
function to find the value of arg that corresponds to the minimum value of val for rows where the condition is true,
using the argMinIf aggregate combinator function.
The argMinIf function is useful when you need to find the value associated
with the minimum value in a dataset, but only for rows that satisfy a specific
condition.
Example usage
In this example, we’ll create a table that stores product prices and their timestamps, and we’ll useargMinIf to find the lowest price for each product when it’s in stock.
Query
argMinIf function will find the price that corresponds to the earliest timestamp for each product,
but only considering rows where in_stock = 1. For example:
- Product 1: Among in-stock rows, 10.99 has the earliest timestamp (10:00:00)
- Product 2: Among in-stock rows, 20.99 has the earliest timestamp (11:00:00)
Response