Forum Discussion
sonm10
Helper I
6 years agoPrevious value with group/category
Hello all, I have values for 3 items against date. I want to calculate the rate of change of the value for the item.The dates are not necessarily consecutives and each item may not have the same ...
- 6 years ago
sonm10 - Sorry, I messed that up.
Column = VAR __Current = [Value] VAR __PreviousDate = MAXX(FILTER('Test','Test'[Date] < EARLIER('Test'[Date]) && [Group] = EARLIER([Group])),[Date]) VAR __Previous = MAXX(FILTER('Test','Test'[Date] = __PreviousDate && [Group] = EARLIER([Group])),[Value]) RETURN __Current - __Previous
sonm10
Helper I
6 years agoHello Greg_Deckler. I have implemented your solution but few data are coming right but most of them are incorrect. Attached below the screenshot of the sample dataset.
I have calcualted the new column as follows:
Column =
VAR __Current = [Value]
VAR __Previous = MAXX(FILTER('Test','Test'[Date] < EARLIER('Test'[Date]) && [Group] = EARLIER([Group])),[Value])
RETURN
__Current - __Previous
The return field is what should be the correct value. Its been calculated in excel for comparisons.
Greg_Deckler
Community Champion
6 years agosonm10 - Sorry, I messed that up.
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Test','Test'[Date] < EARLIER('Test'[Date]) && [Group] = EARLIER([Group])),[Date])
VAR __Previous = MAXX(FILTER('Test','Test'[Date] = __PreviousDate && [Group] = EARLIER([Group])),[Value])
RETURN
__Current - __Previous