Forum Discussion
DAX: Subtract previous row from current row
- 7 years ago
Oh yeah, should have explained that. Yes you can use EARLIER in measures, you would do something like this:
Measure = VAR __index = MAX([Index]) //in visual table context, this is the current index VAR __table = 'Table' VAR __table1 = ADDCOLUMNS(__table,"__diff",[Impressions] - MAXX(FILTER(ALL('Table'),[Index]=EARLIER([Index])-1),[Impressions]) RETURN MAXX(FILTER(__table1,[Index]=__index),[__diff])Something like that, I didn't test it for syntax erros.
Hi Greg_Deckler -
I have a little similar question and would you be able to help -
I have a requirment to subtract from previous row, but the sum of that category, something like ,
I need to create Calc which is basically the MAX(Sum of values - sales value for that category, date row - previous calculated result.)
Please let me know if you have any questions.
askpbiuser Start a new thread for this question. Post sample data as text and expected output. Tag me in the post.
- askpbiuser2 years ago
Helper I
Thank you.
Here is the separate thread - https://community.fabric.microsoft.com/t5/Desktop/DAX-Previous-value-from-measure/td-p/3880390