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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Return Previous Value

Hi all,

 

I've been stuck on this for awhile and have browsed online, but I can't seem to figure it out! I have a table of unique IDs, dates, and statuses. I want to return the previous status for each ID. Any help is much appreciated! I put some sample data in to show what I want to accomplish.

IDDateStatusPrevious Status
11/1/2019Good 
11/2/2019MediumGood
11/3/2019BadMedium
21/1/2019Bad 
21/2/2019MediumBad
21/3/2019MediumMedium
31/1/2019Great 
31/2/2019MediumGreat
41/1/2019GoodMedium
41/2/2019GreatGood
41/3/2019GreatGreat
41/4/2019MediumGreat

 

1 ACCEPTED SOLUTION
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous -

is 'Medium' an error? Does it not belong to [ID] = 3?


@Anonymous wrote:

 

IDDateStatusPrevious Status
11/1/2019Good 
11/2/2019MediumGood
11/3/2019BadMedium
21/1/2019Bad 
21/2/2019MediumBad
21/3/2019MediumMedium
31/1/2019Great 
31/2/2019MediumGreat
41/1/2019GoodMedium
41/2/2019GreatGood
41/3/2019GreatGreat
41/4/2019MediumGreat

 


This mostly works except for what I noted above:

Column = 
LOOKUPVALUE(
    'Table'[Status],
    'Table'[ID],'Table'[ID],
    'Table'[Date],'Table'[Date]-1
)

10.PNG






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

3 REPLIES 3
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous -

is 'Medium' an error? Does it not belong to [ID] = 3?


@Anonymous wrote:

 

IDDateStatusPrevious Status
11/1/2019Good 
11/2/2019MediumGood
11/3/2019BadMedium
21/1/2019Bad 
21/2/2019MediumBad
21/3/2019MediumMedium
31/1/2019Great 
31/2/2019MediumGreat
41/1/2019GoodMedium
41/2/2019GreatGood
41/3/2019GreatGreat
41/4/2019MediumGreat

 


This mostly works except for what I noted above:

Column = 
LOOKUPVALUE(
    'Table'[Status],
    'Table'[ID],'Table'[ID],
    'Table'[Date],'Table'[Date]-1
)

10.PNG






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Yep, that is my mistake! This works. Thank you soooo much!

Hi
Does it still work if your dates are not sequential ?

tks R

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.