Skip to main content
Skip to main content

argMinIf

Description

The If 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 use argMinIf to find the lowest price for each product when it's in stock.

The 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)

See also