Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
3 years ago

Difference between rows in relation to a single data

Hello Community,

I need help calculating the difference between two rows (capital) associated with the same SAME RUT AND DOCUMENT. Each row shows an amount of capital associated with a corresponding date.

Attached information on how I need it to be displayed (I need to get the column in bold):

DocumentRutDateCapitalDif. Capital
1234561234567807-12-202224190
9876545555555524-11-202110000
9901119876543221-01-20196508,970
9901119876543229-05-20196697188,03
9901119876543211-12-20196634-63
9901119876543213-05-20207290656
9901119876543203-12-20207258-32
9901119876543226-05-2021735698
9901119876543205-11-202188661510
9901119876543201-12-20218795-71
9901119876543204-03-20228759-36
9901119876543227-04-20229345586
9901119876543205-07-20229588243
9901119876543206-02-202310136548

For this I made the following calculated column:

Variation =
VAR _Actual = sheet1[Capital insured]
VAR _Previous = MAXX(FILTER(Sheet1,Sheet1[Capital Insured] < _Actual),Sheet1[Capital Insured])
return
(_Actual - _Previous)
Where I get the following:

I need to be able to condition this calculated column with a rut or other unique data.

Thank you very much and greetings!