Search code examples
kqlazure-sentinel

How to apply a user defined function to a range of values in KQL


I have a function that outputs a table:

let my_function = (InputDate: datetime){....}

What I would like to do is apply this function on a range and combine the result as in:

range date_X from ago(7d) to now() step 1d
| project my_function (date_X)

Any ideas? I tried many things but ended up with only code errors


Solution

  • The function should take a table as a parameter, then you can use "invoke" to call it. Here is an example from the docs

    let MyFilter = (T:(x:long), v:long) {
      T | where x >= v
    };
    MyFilter((range x from 1 to 10 step 1), 9)