cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

power bi lookup value previous date

Hi I cannot work out how to do the following in Power BI. I need to create a column with a value of the position of the previous day based on the product ID.

 

I have a large table of product IDs. Each date a product ID has a position. The position ID's are unique for each day, but the ProductID may be present in mutiple PositionID's, so are not unique.

 

So in the example below Product ID 5284 is in position 10019025 o the 5th Dec. I want the new column to return the position of the previous day for that product ID, which is 10019023. I have been attempting to achieve this with Lookup Value but with no success, any suggestions welcome! forum.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: power bi lookup value previous date

@kenmuir71 

 

Column = CALCULATE(MAX(Sheet2[Position]),ALLEXCEPT(Table,Table[ProductID]),Table[Date]=EARLIER(Table[Date])-1)

 


Paul Zheng
Don't forget to hit THUMBS UP and mark it as a solution if it helps you!

View solution in original post

2 REPLIES 2
Highlighted
Super User VI
Super User VI

Re: power bi lookup value previous date

Hi @kenmuir71 

try a column

Column = LOOKUPVALUE(Table1[Position];Table1[ProductId];Table1[ProductId];Table1[Date];Table1[Date]-1)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Highlighted
Community Support
Community Support

Re: power bi lookup value previous date

@kenmuir71 

 

Column = CALCULATE(MAX(Sheet2[Position]),ALLEXCEPT(Table,Table[ProductID]),Table[Date]=EARLIER(Table[Date])-1)

 


Paul Zheng
Don't forget to hit THUMBS UP and mark it as a solution if it helps you!

View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors