How can I find the the first non-null row for a column?

Knowledge Drop

Last tested: Nov 2, 2018
 

There are several methods mostly using the first_value() window function, so results may vary based on your SQL dialect.

If your result set is less than 5000 rows, this Table Calculation pattern will work:

To find the first non-null record in column orders.count:

max(

if(

row()=min(match(${orders.count}, ${orders.count})),

${orders.count}, 0))

More details on this article.

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 12:45 PM
Updated by: