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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

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:
SEBM2023_1-1680205979276.png

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

Thank you very much and greetings!

1 REPLY 1
amitchandak
Super User
Super User

@Syndicate_Admin , a new column

 

=

var _max = maxx(filter(Table, [document] = earlier([Document])  && [Date] < earlier([Date]) ), [Date] )

return

maxx(filter(Table, [document] = earlier([Document])  && [Date] =_max ), [captial] )

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

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