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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Lookup on different tables by unique concatenated search criteria

Hi,

 

I have two tables, one is the inventory table, the other is the transaction table. See below printscreen. What I am trying to achieve is the following: In the on hand table I want the comment to be displayed from the material transaction table (value column K displayed in column E). I want a lookup from the combination article number and subinventory from the on hand table, to the article and subinventory from the material transaction table. This my search criteria (in excel I build it in column D and H). To be displayed in the inventory table (column E) should be the comment of the maximum transaction date (column I) in relation to my search criteria. How should I achieve this by Power BI and dax? Step by step please. Many thanks in advance for your help!

 

Capture.PNG

 

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

Hi @Anonymous ,

 

Please try to add a calculated column in the Inventory table:

Comment =
VAR _a =
    MAXX (
        FILTER (
            'Transaction',
            [Search criteria] = EARLIER ( Inventory[Search criteria] )
        ),
        [Transaction date]
    )
RETURN
    CALCULATE (
        MAX ( 'Transaction'[Comment] ),
        FILTER (
            'Transaction',
            [Search criteria] = EARLIER ( 'Inventory'[Search criteria] )
                && [Transaction date] = _a
        )
    )

Final output:

vjianbolimsft_0-1670823024744.png

Best Regards,

Jianbo Li

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try to add a calculated column in the Inventory table:

Comment =
VAR _a =
    MAXX (
        FILTER (
            'Transaction',
            [Search criteria] = EARLIER ( Inventory[Search criteria] )
        ),
        [Transaction date]
    )
RETURN
    CALCULATE (
        MAX ( 'Transaction'[Comment] ),
        FILTER (
            'Transaction',
            [Search criteria] = EARLIER ( 'Inventory'[Search criteria] )
                && [Transaction date] = _a
        )
    )

Final output:

vjianbolimsft_0-1670823024744.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Bifinity_75
Solution Sage
Solution Sage

Hi @Anonymous , try this:

- Create a calculate column in your transaction table:

Search_Criteria2 = IF (CALCULATE(max('Transaction table'[Transaction date]),
ALLEXCEPT('Transaction table','Transaction table'[Search_Criteria]))='Transaction table'[Transaction date],
'Transaction table'[Search_Criteria],"xxx")

 

- And in your Inventory table, create this calculate column:

Comment__ = 
maxx(filter('Transaction table' , 
        search('Transaction table'[Search_Criteria2],'Inventory Table'[Search Criteria],,0)>0),
        'Transaction table'[Comment])

Best Regards

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors