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

New column to populate previous value

I have a table similar to below, i would like to add a 'new column' to popular 'Previous Status' by ID and Date. In Excel, I can sort by ID and Date, then insert a funcation = previous value.    how to do it in DAX? thanks. 

CRM.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous,

Right Click your table in Fields panel and select “New Column”, then enter the following DAX.

Previous Status =
var previous= CALCULATE(FIRSTNONBLANK(Table[Status],""),FILTER(Table,Table[ID]=EARLIER(Table[ID])&& Table[Date]<EARLIER(Table[Date])))
return
 IF(ISBLANK(previous),BLANK(), previous)



Regards,
Lydia

View solution in original post

3 REPLIES 3
AdithyaVar
Frequent Visitor

I have the same requirement, but the IDs & Dates are not sorted. Can you provide a formula which works even on unsorted data

Anonymous
Not applicable

@Anonymous,

Right Click your table in Fields panel and select “New Column”, then enter the following DAX.

Previous Status =
var previous= CALCULATE(FIRSTNONBLANK(Table[Status],""),FILTER(Table,Table[ID]=EARLIER(Table[ID])&& Table[Date]<EARLIER(Table[Date])))
return
 IF(ISBLANK(previous),BLANK(), previous)



Regards,
Lydia

Anonymous
Not applicable

on the  'solved solution' I get: 

The syntax for 'Table' is incorrect. (DAX(var previous= CALCULATE(FIRSTNONBLANK(Table[Status],""),FILTER(Table,Table[ID]=EARLIER(Table[ID])&& Table[Date]<EARLIER(Table[Date])))return IF(ISBLANK(previous),BLANK(), previous))).

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors