Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Advanced Editor - Add Column from Related Table

Added a column from a related table but found out it is not available in Merge tables dialog (Ex: Column = RELATED('Account'[SubRegion]) ).  Found a suggestion to add the column using the Advanced Ed...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Yes, I was mixing DAX with M.  The end objective is to merge two tables, but Custom columns are not available in a merge.  The big picture is to merge Actuals table with Targets table to visualize the % diffs.  The Actuals table needs to join data between three tables and the required column is two joins over from the first table. 

     

    Enter the Advanced Editor of the middle table and add a table.join before the final "in" clause to get two columns (Account Key, SubRegion) from the Account table:

     

    #"GetSubRegion" = Table.Join(#"Replaced Value2","Account Record Key",Table.SelectColumns(#"Account", {"Account Key","SubRegion"} ), "Account Key",JoinKind.Inner)
    in
        #"GetSubRegion"

     

    Enter the Advanced Editor of the first table and add a table.join before the final "in" clause to get two columns (Opportunity Key, SubRegion) from the above table:

     

     #"GetSubRegion2" = Table.Join(#"GetFiscalQuarter","Opportunity LI Key",Table.SelectColumns(#"Opportunity", {"Opportunity Key","SubRegion"} ), "Opportunity Key",JoinKind.Inner)
    in
        #"GetSubRegion2"

    Now that SubRegion is in the first table the rest of the data can be grouped then merged with the Target table.  Any shortcuts to this effort?

    HTH,

    Smitty