Forum Discussion
Anonymous
5 years agoNot applicable
Caculating previous row data
Dear All,
Could you please show me how to caculating previous row data.
Source:
| FROM DATE | Duration | Expected |
| 5/31/2019 | 5 | |
| 6/10/2019 | 2 | 2 |
| 6/24/2019 | 3 | 3 |
| 7/26/2019 | 10 | 4 |
| 9/26/2019 | 2 | 5 |
Destination:
| FROM DATE | Duration | Expected | Result |
| 5/31/2019 | 5 | Null | |
| 6/10/2019 | 2 | 2 | Null |
| 6/24/2019 | 3 | 3 | -1 |
| 7/26/2019 | 10 | 4 | -7 |
| 9/26/2019 | 2 | 5 | 2 |
- Result = Expected - pre(Duration)
Many thanks,
@ptkhoa2110 , Try a new column as
new column ?
var _last a maxx(filter(Table, [FROM DATE] < earlier([FROM DATE])),[FROM DATE])
Return
if(isblank([expected]) to isblank(_last) , blank() , maxx(filter(Table, [FROM DATE] to _last),[Duration]) -[expected])
5 Replies
- amitchandakSuper User
@ptkhoa2110 , Try a new column as
new column ?
var _last a maxx(filter(Table, [FROM DATE] < earlier([FROM DATE])),[FROM DATE])
Return
if(isblank([expected]) to isblank(_last) , blank() , maxx(filter(Table, [FROM DATE] to _last),[Duration]) -[expected])- AnonymousNot applicable
- amitchandakSuper User
Anonymous ,
Please find the attached file after the signature . But logic you told is not matching