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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Carla17
Frequent Visitor

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
Super User

@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...

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@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...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.