This example illustrates how to use the conditional ranking function
KTHLARGESTIF in your recipes.
Here is some example weather data:
In this case, you want to find out the second-most measures for rain, temperature, and wind in Center Town for the week.
You can see in the preview that the value is
aggregate value:KTHLARGESTIF(rain_cm,2,city == 'Center Town')
1.32. Before adding it to your recipe, you change the step to the following:
The value is
aggregate value:KTHLARGESTIF(temp_C,2,city == 'Center Town')
20. For wind, you modify it to be the following:
aggregate value:KTHLARGESTIF(wind_mph,2,city == 'Center Town')
You can choose to add any of these steps to generate an aggregated result. As an alternative, you can use a
derive transform to insert these calculated results into new columns.