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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors