Forum Discussion
Find or refer to previous value using the date column
I would like to find or refer to the previous value in a time series so I can do a simple difference calculation between the current and the previous value.
The database i have has a date column, frequency, value. Each time series has different reporting frequency such as monthly, quarterly, yearly. I would like to be able to add another column in the database to show the prior value for the specific time series. Is this possible when the database has varying reporting frequencies?
Any help would be much appreciated
22 Replies
- Habib
Continued Contributor
If you want to refer to previous values in date hierarchy you can use DAX functions like PREVIOUSDAY, PREVIOUSMONTH, PREVIOUSQUARTER, PREVIOUSYEAR.
If you want to refer to value available in previous row then you can use EARLIER function.
- sebbyp
Helper III
Thanks for your response. I cannot use previous because the collection of time series in the single database has different reporting frequencies. So the collection of time series in the data set can be reported on a daily, monthly, quarterly annually. This doesn't help with previous functions.
I am not sure if the earlier function can work with this too. Maybe i don't quite understand how this function works. Please elaborate if you can.
Thanks
- Habib
Continued Contributor
I am unable to understand you probelm. If you provide some sample data that would be great and will be easy to answer your question.
EARLIER help can be found here.
https://msdn.microsoft.com/en-us/library/ee634551.aspx