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.
pivot value:KTHLARGESTIF(rain_cm,2,city == 'Center Town') limit:1
You can see in the preview that the value is
1.32. Before adding it to your recipe, you change the step to the following:
pivot value:KTHLARGESTIF(temp_C,2,city == 'Center Town') limit:1
The value is
20. For wind, you modify it to be the following:
pivot value:KTHLARGESTIF(wind_mph,2,city == 'Center Town') limit:1
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.