Forum Discussion

robbie337's avatar
robbie337
Advocate I
10 years ago
Solved

Relationship fail when adding column from another table (where relationship seems to be correct)

Hi,   I've had a good hunt around, and can't find this problem anywhere, apologies if it has been posted already.   I have a table containing data aggregated by a number of dimensions in Power BI...
  • greggyb's avatar
    10 years ago

    Your model diagram would be quite helpful here, but I can take a guess. You're trying to use a bare column reference in a Calculated Column:

    // DAX
    // Calculated Column
    // Incorrect syntax
    MyNewColumn =
    'LookupTable'[Field]
    // The above is incorrect because relationships are not evaluated by
    // default in a row context.
    
    
    // Correct
    MyNewColumn =
    RELATED( 'LookupTable'[Field] )

     

    Ninja edit: Also, if you already have a dimension (lookup table), there's no need to bring your sort field into the primary fact table. You can absolutely should use your dimension fields as the labels and categories in visualizations.