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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.