Forum Discussion

MichaelBristol's avatar
MichaelBristol
Frequent Visitor
5 years ago
Solved

Lookup and Verify Three Columns on Another Table and Generate a Value

What I am trying to accomplish with no success is the following.   Table 1 (Simplified for example) Unit Num A1111 B2222 C3333   Table 2 Date                     Unit              ...
  • Fowmy's avatar
    5 years ago

    MichaelBristol 

    I created a column that returns the result you are looking for:

    Color Value = 
    var __maxdate = 
    MAXX(
        FILTER(
            'Table 2',
            'Table 2'[Unit] = 'Table 1'[Unit Num]
        ),
        'Table 2'[Date]
    )
    var __result = 
    IF(
        ISEMPTY(
            FILTER(
                'Table 2',
                'Table 2'[Unit] = 'Table 1'[Unit Num] &&
                'Table 2'[Date] = __maxdate &&
                'Table 2'[NumColor] = "Red"
            )
        ),
        0,
        5
    )
    return
        __result