iif([Level]=0 and [MakeOrBuy]="Buy",0,
iif(!IsNull([Row-1:BuyParentLevel]) and [Row-1:BuyParentLevel]<[Level],
[Row-1:BuyParentLevel],
iif([Row-1:MakeOrBuy]="Buy" and [Row-1:Level]<[Level],
[Row-1:Level],Null())))
I have the above statements in My "MultiRow Tool",
I have the following input data as in picture ,am getting the right output. But am confused whether we can do such a thing if we want to do in a Sql ,if we have a table like tha input data. I need SQL equivalent/If possible PySpark Equivalent of this scenario.