Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
Is it possible to access the previous row of a measure in another measure.
Measure1 | Measure 2 (Output) |
10 | |
20 | 10 |
30 | 20 |
40 | 30 |
50 | 40 |
Solved! Go to Solution.
Hi @klehar
Here I build a sample to show you how to get previous result in Measure2.
Measure1:
Measure1 = SUM('Table'[Value])
Measure2:
Measure2 =
VAR _T =
SUMMARIZE ( ALL ( 'Table' ), 'Table'[Category], "Measure1", [Measure1] )
VAR _T2 =
ADDCOLUMNS ( _T, "RANK", RANKX ( _T, [Measure1],, ASC, DENSE ) )
VAR _T3 =
ADDCOLUMNS (
_T2,
"Pre",
SUMX ( FILTER ( _T2, [RANK] = EARLIER ( [RANK] ) - 1 ), [Measure1] )
)
RETURN
SUMX ( FILTER ( _T3, [Category] = MAX ( 'Table'[Category] ) ), [Pre] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @klehar
Here I build a sample to show you how to get previous result in Measure2.
Measure1:
Measure1 = SUM('Table'[Value])
Measure2:
Measure2 =
VAR _T =
SUMMARIZE ( ALL ( 'Table' ), 'Table'[Category], "Measure1", [Measure1] )
VAR _T2 =
ADDCOLUMNS ( _T, "RANK", RANKX ( _T, [Measure1],, ASC, DENSE ) )
VAR _T3 =
ADDCOLUMNS (
_T2,
"Pre",
SUMX ( FILTER ( _T2, [RANK] = EARLIER ( [RANK] ) - 1 ), [Measure1] )
)
RETURN
SUMX ( FILTER ( _T3, [Category] = MAX ( 'Table'[Category] ) ), [Pre] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please follow the recommendations outlined in this thread to help us help you:
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
Proud to be a Super User!
Paul on Linkedin.