cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mohamedh Frequent Visitor
Frequent Visitor

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

Accepted Solutions
v-huizhn-msft Super Contributor
Super Contributor

Re: Calculation using previous day value

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

CheenuSing Super Contributor
Super Contributor

Re: Calculation using previous day value

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

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
v-huizhn-msft Super Contributor
Super Contributor

Re: Calculation using previous day value

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

CheenuSing Super Contributor
Super Contributor

Re: Calculation using previous day value

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

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 330 members 3,344 guests
Please welcome our newest community members: