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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DAX - Return Immediate Previous row value based on existing Rank

Hello there, 

 

I need a calculated column "Result" to be filled up with the immediate previous row value as shown below.

 

Any suggestions please? PS: Do not want this to be a measure value, so may be this could be returned as a table output which can act like a temporary table. There are additional calculations lined up on top of this output.

 

IDDateRankResult ( Immediate Previous Date based on Rank for each ID)
101/01/20212 
102/01/2021101/01/2021
201/01/20213 
203/01/2021201/01/2021
205/01/2021103/01/2021

 

Thanks,

Pravallika

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Add the following calculated column to your table:

Result = 
var __currentrank = Table11[Rank]
var __currentid = Table11[ID]
var result  = 
    MAXX(
        FILTER( Table11 , Table11[ID] = __currentid && Table11[Rank] = __currentrank + 1 ),
        Table11[Date]
    )
return
    result

Fowmy_0-1620602635559.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@Anonymous 

Add the following calculated column to your table:

Result = 
var __currentrank = Table11[Rank]
var __currentid = Table11[ID]
var result  = 
    MAXX(
        FILTER( Table11 , Table11[ID] = __currentid && Table11[Rank] = __currentrank + 1 ),
        Table11[Date]
    )
return
    result

Fowmy_0-1620602635559.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.