Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
klehar
Helper V
Helper V

Access previous row measure in another measure

Hi,

 

 

Is it possible to access the previous row of a measure in another measure.

Measure1Measure 2 (Output)
10 
2010
3020
4030
5040
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @klehar 

Here I build a sample to show you how to get previous result in Measure2.

1.png

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.

2.png

 

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.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @klehar 

Here I build a sample to show you how to get previous result in Measure2.

1.png

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.

2.png

 

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.

 

PaulDBrown
Community Champion
Community Champion

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 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors