Forum Discussion
archerjayden
Helper I
6 years agoDAX Row minus Previous Row
Hi, I am looking for help on achieving moving range from data. How do I get DAX to subtract row by previous row? I am working on SQL Server direct query mode and unable to crack this for my report...
Fowmy
Super User
6 years agoarcherjayden
This could work:
Column =
VAR _DATE = 'Table'[A]
VAR _LASTDATE =
CALCULATE(
MAX('Table'[A]),
FILTER('Table','Table'[A] < _DATE)
)
RETURN
[B]
-
CALCULATE(
MAX([C]),FILTER('Table','Table'[A] = _LASTDATE))
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂