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!View all the Fabric Data Days sessions on demand. View schedule
Hello Community,
I need help calculating the difference between two rows (capital) associated with the 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):
| Document | Rut | Date | Capital | Dif. Capital |
| 123456 | 12345678 | 07-12-2022 | 2419 | 0 |
| 987654 | 55555555 | 24-11-2021 | 1000 | 0 |
| 990111 | 98765432 | 21-01-2019 | 6508,97 | 0 |
| 990111 | 98765432 | 29-05-2019 | 6697 | 188,03 |
| 990111 | 98765432 | 11-12-2019 | 6634 | -63 |
| 990111 | 98765432 | 13-05-2020 | 7290 | 656 |
| 990111 | 98765432 | 03-12-2020 | 7258 | -32 |
| 990111 | 98765432 | 26-05-2021 | 7356 | 98 |
| 990111 | 98765432 | 05-11-2021 | 8866 | 1510 |
| 990111 | 98765432 | 01-12-2021 | 8795 | -71 |
| 990111 | 98765432 | 04-03-2022 | 8759 | -36 |
| 990111 | 98765432 | 27-04-2022 | 9345 | 586 |
| 990111 | 98765432 | 05-07-2022 | 9588 | 243 |
| 990111 | 98765432 | 06-02-2023 | 10136 | 548 |
Greetings and thank you very much
@Syndicate_Admin See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
Thank you very much for your help ... I was trying to do it according to your example and it works for me ... but how could this column calculated based on RUT and Document condition?
This code worked for me, but I need to condition it:
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!