问题
I have a list of Employee names and Salaries in the following order
I need to create the output table in the below format. ie, whenever the accumulated salary-total crosses 3000 I have to detect that and mark that row.
I have tried to do row_cumsum and reset the Term once it crossed 3000 but it didn't work for the second iteration.
datatable (name:string, month:int, salary:long)
[
"Alice", 1, 1000,
"Alice", 2, 2000,
"Alice", 3, 1400,
"Alice", 3, 1400,
"Alice", 3, 1400,
]
| order by name asc, month asc
| extend total=row_cumsum(salary)
| extend total=iff(total >=3000,total-prev(total),total)
来源:https://stackoverflow.com/questions/65501902/kusto-row-cumsum-modifying-the-term-if-term-reaches-a-point