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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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.
Solved! Go to Solution.
@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
I have the same requirement, but the IDs & Dates are not sorted. Can you provide a formula which works even on unsorted data
@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
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))).