Eiten
Eiten

Reputation: 149

LOOKUPVALUE filtered to last row

I try to add column from from a different table with DAX:

Strand UTol = LOOKUPVALUE('CAQ_Wire T_USER_REALVALS - Strand'[UTol], 'CAQ_Wire T_USER_REALVALS - Strand'[CoilNo], 'LEONI DEV$Lot Measurement'[Lot No_])

Formula is correct, the reason of error is that have two rows that meet the condition:

Example: N0058734 in the searched table:

enter image description here

The value on the basis of which I am looking (N0058734) is twice. Can I filter it based on date, or Id. Something like find the last one.

Upvotes: 0

Views: 30

Answers (1)

Ryan
Ryan

Reputation: 2482

This is the sample data I used

enter image description here

try this to create a column

Column=
VAR _max =
    MAXX (
        FILTER ( 'Table (2)', 'Table (2)'[CoilNo] = 'Table (3)'[CoilNo] ),
        'Table (2)'[ID]
    )
RETURN
    MAXX (
        FILTER (
            'Table (2)',
            'Table (2)'[CoilNo] = 'Table (3)'[CoilNo]
                && 'Table (2)'[ID] = _max
        ),
        'Table (2)'[value]
    )

enter image description here

Upvotes: 0

Related Questions