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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
mohamedh
Advocate II
Advocate II

Calculation using previous day value

Hi Is there a way to do a calucation whereby i can add my previous day value to my current day calculation?

 

eg. previous day closing stock + opening stock current day =

 

Thanks

2 ACCEPTED SOLUTIONS
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @mohamedh,

Of course, you should lookup the previous day first, then calcualte it using calculated column.

I create sample data table.

 

1.PNG

 

Create a column ranked by date, then lookup the previous day value based on the rank colculated column.

 

Rank = RANKX(Test,Test[Date],,ASC)

previous day closing value = LOOKUPVALUE(Test[closing stock],Test[Rank],Test[Rank]-1)


Finally add the current day value and previous day value together. Please see the formula and screenshot below.

 

previous-day-closing+opening-stock-current-day = Test[closing stock]+Test[previous day closing value]

2.PNG


If you have other issues, don't hesitate to let me know.

 

Best Regards,
Angelia

View solution in original post

Anonymous
Not applicable

Hi @mohamedh

 

The link

 

http://blog.gbrueckl.at/2015/04/recursive-calculations-powerpivot-dax/

 

may be helpful. Check it out. If it solves your issue please give KUDOS.

 

Cheers

 

CheenuSing

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @mohamedh

 

The link

 

http://blog.gbrueckl.at/2015/04/recursive-calculations-powerpivot-dax/

 

may be helpful. Check it out. If it solves your issue please give KUDOS.

 

Cheers

 

CheenuSing

 

v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @mohamedh,

Of course, you should lookup the previous day first, then calcualte it using calculated column.

I create sample data table.

 

1.PNG

 

Create a column ranked by date, then lookup the previous day value based on the rank colculated column.

 

Rank = RANKX(Test,Test[Date],,ASC)

previous day closing value = LOOKUPVALUE(Test[closing stock],Test[Rank],Test[Rank]-1)


Finally add the current day value and previous day value together. Please see the formula and screenshot below.

 

previous-day-closing+opening-stock-current-day = Test[closing stock]+Test[previous day closing value]

2.PNG


If you have other issues, don't hesitate to let me know.

 

Best Regards,
Angelia

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.