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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
sprao
Helper I
Helper I

POWER BI

Hi,

I want to lookup Price column into another table with latest date value only when matches the itemno

sprao_0-1675913486173.png

 

please help me how to write lookup formula

 

 

1 ACCEPTED SOLUTION

Hi @sprao 

 

From your data, one item may have multiple prices on a date. If I understand it correctly, your original Items table is in an order that the price on the top is the earliest value and the price on the bottom is the latest value on the same date, right? With this logic, you can use Power Query Editor to add an Index column first,

vjingzhang_1-1675996764927.png

Then go to Power BI Desktop, create a calculated table with below DAX:

Price Table = 
SUMMARIZE (
    ItemsTable,
    ItemsTable[Item No],
    "Price",
        CALCULATE (
            MAX ( ItemsTable[Price] ),
            ItemsTable[Index] = MAX ( ItemsTable[Index] )
        )
)

vjingzhang_0-1675996689474.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@sprao , what happen when that date is not there, assum you can take the next date

 

New column in item Table

 

Price new =

var _max = Minx(filter(Price,Price[Itemno] = item[ItemNo] && Price[Date]>= item[Date]) , price[Date])

return

Minx(filter(Price,Price[Itemno] = item[ItemNo] && Price[Date]=_max) , price[Price])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

sorry i price table dont have Date column, i just kept understanding purpose

Hi @sprao 

 

From your data, one item may have multiple prices on a date. If I understand it correctly, your original Items table is in an order that the price on the top is the earliest value and the price on the bottom is the latest value on the same date, right? With this logic, you can use Power Query Editor to add an Index column first,

vjingzhang_1-1675996764927.png

Then go to Power BI Desktop, create a calculated table with below DAX:

Price Table = 
SUMMARIZE (
    ItemsTable,
    ItemsTable[Item No],
    "Price",
        CALCULATE (
            MAX ( ItemsTable[Price] ),
            ItemsTable[Index] = MAX ( ItemsTable[Index] )
        )
)

vjingzhang_0-1675996689474.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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