cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Carla17
New Member

Compare values of a previous date

Hi, 

I managed to import stock data from Yahoo Finance. I used the method discribed here. The result is a table like this:

 

Carla17_0-1623860960611.png

So I have daily records for mulipte "QuoteSymbols". 

I would like to calculate the difference between the "close" of a specific day with the "close" from the previous day. 

 

I tried this measure: 

Close previous day = CALCULATE(SUM(StockList[Adj Close]),PREVIOUSDAY(StockList[Date]))

 
But, because I don't have records for weekends, this is not the correct way to go. 
 
Carla17_1-1623861566820.png

 

 
I tried several other solutions, but they don't give me the correct values. I'm not sure to do this with a measure or calculated column. 
 
Can anybody help me finding the solution?
 
Best regards,
 
Carla
1 ACCEPTED SOLUTION
amitchandak
Super User IV
Super User IV

@Carla17 , Try a measure like Last Day Non Continuous  in example . with a date table, refer my blog that have more details 

 

Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),previousday('Date'[Date]))

 

 

Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

1 REPLY 1
amitchandak
Super User IV
Super User IV

@Carla17 , Try a measure like Last Day Non Continuous  in example . with a date table, refer my blog that have more details 

 

Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),previousday('Date'[Date]))

 

 

Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors