Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reverse running total in a column should starts from -ve values and end once

Hi All,

I need help for doing revrese cumulative total for column having -ve values. Please check the below data and explanation on exactly what I needed.

STDateLoadIndexOutput
10 August 2020100000011000000
11 August 2020200000021000000
12 August 202030000003-1000000
13 August 202040000004-4000000
14 August 2020-80000005-8000000
15 August 2020600000066000000

In above table 1st three columns are actual data and output column is expected output. Calculation in output column is rverese running total for only neagtive values in load column based on STDate column order. Here running total starts from -800000+4000000+3000000+2000000 and running total should be stop up to the value become positive. In above table revrese running total starts from index 5 to index 2 where it becomes positve at 1000000 of index2.
  So please help me in achieving the output column as expected.

 

Thanks

Praneeth

Status: New
Comments
v-yuta-msft
Community Support

@Anonymous ,

 


Here running total starts from -800000+4000000+3000000+2000000 and running total should be stop up to the value become positive.

Could you please clarify more details about the logic you mentioned above?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

Hi Jimmy,

 

we have a load column actual data output column is expected one. In load column we have negative value -8000000 and that value should be add to previous row vaue 4000000 then it becomes -4000000 and again it should be add to previous value 3000000 then it will become -1000000 again it should be add with 2000000 and then it become 1000000 and now i should be stop the adding to previous value because now it is positive. Finally if there is -ve value in a column it hsould be add to previous row values upto it become positive