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
norway84
Frequent Visitor

Lookupvalue date challenge

Hi,

 

I have two tables which have no relations:

  • Table 1 with my sales transactions. The relevant columns are:
    • SKU_ID
    • DATE
  • Table 2 with historic price changes
    • SKU_ID
    • DATE_PRICE_CHANGE 
    • PRICE

In Table 1 I would like a calculated columns with the relevant price. I would like to retrive the "PRICE" for the relevant SKU_ID where DATE_PRICE_CHANGE is the highest possible but still lower than DATE in TABLE 1.

 

So I imagine it would be something like the formula below where I need help with "xxxxxxxxx"-part

PRICE =
LOOKUPVALUE (
    Table2[Price];
    Table2[SKU_Id]; Table1[SKU_id];
    Table2[DATE_PRICE_CHANGE]; xxxxxxxxxxxxxxxxxx...............Table1[DATE]
)

 

Thank you in advance for any help. If "lookupvalue" isn't the best solution for this I'm happy for other suggestions as well.

 

Best regards,

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@norway84,

 

You may refer to the following example.

http://community.powerbi.com/t5/Desktop/Find-last-value-based-on-date/m-p/293150#M129228

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@norway84,

 

You may refer to the following example.

http://community.powerbi.com/t5/Desktop/Find-last-value-based-on-date/m-p/293150#M129228

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.