Forum Discussion
drivas771994
Helper II
8 years agoIs there a formula for calculating the difference between rows.
Hi, I'm trying to calculate the difference between two values in the same column. For example, I have a student (John Doe) who took one test on 9/1/2018 and received a 76 and then retook the test...
- 8 years ago
Hi drivas771994
I do not see your formula.
Nevertheless I prepared the PowerBI version for you
Please see attached pbix file
Zubair_Muhammad
Community Champion
8 years ago
Try this pattern
Difference from Previous Score =
VAR previousrow =
TOPN (
1,
FILTER (
Table1,
[Student] = EARLIER ( [Student] )
&& [Test Date] < EARLIER ( [Test Date] )
),
[Test Date], DESC
)
VAR previousscore =
MINX ( previousrow, [Score] )
RETURN
IF ( NOT ( ISBLANK ( previousscore ) ), [Score] - previousscore )
drivas771994
Helper II
8 years agoThis looks like it is on excel. Is it?
- Zubair_Muhammad8 years ago
Community Champion
HI drivas771994
Apologies for late reply.
Yes this is Excel. and this will work in Power BI as well.
- drivas7719948 years ago
Helper II
So currently when I plug that formula in I get some syntax errors.
All of my columns are spelled correctly. Am I doing something wrong here?
- Zubair_Muhammad8 years ago
Community Champion
Hi drivas771994
I do not see your formula.
Nevertheless I prepared the PowerBI version for you
Please see attached pbix file