Hi Anvesh Kasani,
Thank you for posting query in Microsoft Q&A Platform.
You are hitting this failure because of limitations of
toscalar()
function.toscalar()
function cannot be applied on a scenario where function applies on each row. click here to know more about it.
For example, below code results in same error which you are facing.
let _dataset2 = datatable(x:long, y:long) [ 1, 2, 3, 4, 5, 6];
let tg = (x_: long)
{
toscalar(_dataset2| where x == x_ | project y);
};
_dataset1
| extend y = tg(x)
To avoid error where we can use join
operator as below.
let _dataset1 = datatable(x: long)[1, 2, 3, 4, 5];
let _dataset2 = datatable(x: long, y: long) [1, 2, 3, 4, 5, 6];
_dataset1
| join (_dataset2) on x
| project x, y
Hope this helps.
Please consider hitting Accept Answer
button. Accepted answers help community as well.