Forum Discussion
Anonymous
5 years agoNot applicable
Re: Previous Row Value for First Line
Hi,
I need help with the following. Currently, the first line of my output for 'New Column' is not the result I wanted. First line should be 'Current Balance' (-335.00) - 'Amount' (-235.00). How do I add this in my current script?
Current Script:
New Column =
VAR PreviousRow =
TOPN (
1,
FILTER ( Table, Table[Date ] < EARLIER ( Table[Date ] ) ), [Date ], ASC)
VAR PreviousValue =
MINX ( PreviousRow, Table[ Amount] )
RETURN
Table[ Amount] + PreviousValue
Current Output:
| Customer | No | Type | Date | Amount | Current Balance | New Column |
| BI111 | 2300000008 | Customer Payment | 4/2/2019 | -235.00 | -335.00 | -235.00 |
| BI111 | 1200000019 | SD-Billing Document | 4/6/2019 | 251.00 | -351.00 | |
| BI111 | 1200000030 | SD-Billing Document | 4/12/2019 | 203.00 | -554.00 | |
| BI111 | 1200000051 | SD-Billing Document | 4/20/2019 | 93.00 | -647.00 | |
| BI111 | 2300000040 | Customer Payment | 4/24/2019 | -279.00 | -368.00 | |
| BI111 | 2300000041 | Customer Payment | 4/24/2019 | -504.00 | 136.00 | |
| BI111 | 1200000076 | SD-Billing Document | 4/26/2019 | 76.00 | 60.00 | |
| BI111 | 2300000087 | Customer Credit | 4/30/2019 | -10.00 | 70.00 | |
| BI111 | 2300000088 | Customer Credit | 4/30/2019 | -17.00 | 87.00 |
Desired Output:
| Customer | No | Type | Date | Amount | Current Balance | New Column |
| BI111 | 2300000008 | Customer Payment | 4/2/2019 | -235.00 | -335.00 | -100.00 |
| BI111 | 1200000019 | SD-Billing Document | 4/6/2019 | 251.00 | -351.00 | |
| BI111 | 1200000030 | SD-Billing Document | 4/12/2019 | 203.00 | -554.00 | |
| BI111 | 1200000051 | SD-Billing Document | 4/20/2019 | 93.00 | -647.00 | |
| BI111 | 2300000040 | Customer Payment | 4/24/2019 | -279.00 | -368.00 | |
| BI111 | 2300000041 | Customer Payment | 4/24/2019 | -504.00 | 136.00 | |
| BI111 | 1200000076 | SD-Billing Document | 4/26/2019 | 76.00 | 60.00 | |
| BI111 | 2300000087 | Customer Credit | 4/30/2019 | -10.00 | 70.00 | |
| BI111 | 2300000088 | Customer Credit | 4/30/2019 | -17.00 | 87.00 |
Anonymous , refer if the file attached after signature can help.
Created two-column. Check those
1 Reply
- amitchandakSuper User
Anonymous , refer if the file attached after signature can help.
Created two-column. Check those