Forum Discussion

RichardLinderma's avatar
1 year ago
Solved

How to create a calculated measure using columns from two different tables without a relationship

I'm trying to create a calculated measure that combines both the Origin and Destination points of travel. The two columns are Origin[city_name] and Destination[city_name], and I want the new measure ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi RichardLinderma ,

    I create two tables and they have no relationships.

    Then I create a measure and I think you can try on this DAX code.

    Measure = 
    VAR _OriginCity =
        MAX ( 'Origin'[city_name] )
    VAR _DestinationCity =
        CALCULATE (
            VALUES ( 'Destination'[city_name] ),
            'Destination'[city_id] = MAX ( 'Origin'[city_id] )
        )
    RETURN
        _OriginCity & "/" & _DestinationCity

     

     

    Best Regards

    Yilong Zhou

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