Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Compare two columns in different tables

I would like to compare two columns in different tables using a measure (and not a calculated column). I made a simple example to illustrate my problem:   Data Model Table A Table B ...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi, Anonymous 

    This occurs primarily because multi-ended tables cannot filter one-ended tables.

    Here are the steps you can refer to :

    (1)My test data is the same as yours.

    (2)We can create three measures :

    Value_A = var _aid= SELECTEDVALUE('Central'[ID_Table_A])
    var _a_value=MAXX( FILTER(ALL('Table A'), 'Table A'[ID_Table_A] = _aid) ,[Value_A])
    var _b = SELECTEDVALUE( 'Table B'[Value_B])
    return
    _a_value
    Value_B = var _bid= SELECTEDVALUE('Central'[ID_Table_B])
    var _b_value=MAXX( FILTER(ALL('Table B'), 'Table B'[ID_Table_B] = _bid) ,[Value_B])
    return
    _b_value
    Comparison = IF( [Value_A]= [Value_B] ,"True","False")

     

    (3)Then we need to put the 'Central'[ID_Table_A] and 'Central'[ID_Table_B] on the visual , and the three measures then we will meet your need , the result is as follows:

    For multi-ended tables, if we need to get the contents of a one-ended table, but we don't want to create new columns to implement it, we need to put the ID of the multi-ended table in the visual.

     

    Best Regards,

    Aniya Zhang

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