Kusto row_cumsum modifying the Term if Term reaches a point

只愿长相守 提交于 2021-02-08 03:59:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!