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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Column with value from previous day / row

Hey there

 

I have a table for Add, Minus, Net Mvmt and Closing bal by date setup as columns in PowerBI.

 

How can I add a column (Opening Bal) which takes the Closing Balance from previous date?

 

Thanks!

 

 AddMinusNet MvmtClosing BalOpening Bal
6-Jan100505050 
7-Jan200 20025050
8-Jan300100200450250
1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Anonymous Please add and Index column in Power Query Editor and then use the below DAX as New Column.

 

If your data is not in sorted order by date then add a Rank column as below instead of Index and then use this Rank field in place of Index in DAX formula

 

Rnk = RANKX(Test169PrevRow,Test169PrevRow[Date],,ASC)

 

OpeningBal = LOOKUPVALUE(Test169PrevRow[Closing Bal],Test169PrevRow[Index],Test169PrevRow[Index]-1)

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous,

 

If your table not contain duplicate date, you can direct use data as iterator to looping your records.

Opening Bal =
VAR prevDate =
    CALCULATE (
        MAX ( Table[Date] ),
        FILTER ( ALL ( Table ), [Date] < EARLIER ( Table[Date] ) )
    )
RETURN
    LOOKUPVALUE ( Table[Closing Bal], Table[Date], prevDate )

If not, you can consider to use PattemManohar's suggestion to add index column as iterator.

 

Regards,
Xiaoxin Sheng

PattemManohar
Community Champion
Community Champion

@Anonymous Please add and Index column in Power Query Editor and then use the below DAX as New Column.

 

If your data is not in sorted order by date then add a Rank column as below instead of Index and then use this Rank field in place of Index in DAX formula

 

Rnk = RANKX(Test169PrevRow,Test169PrevRow[Date],,ASC)

 

OpeningBal = LOOKUPVALUE(Test169PrevRow[Closing Bal],Test169PrevRow[Index],Test169PrevRow[Index]-1)

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors