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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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