Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

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 Editor, but editor flags the single quote in the table name.  Anyone have an example of using RELATED in the advanced editor to add a column?  The needed column is two joins over in the relationship diagram.  Data Source is OpportunityLineItem in SalesForce; so SQL views are less than convenient.

Advanced editor failed attempt:

,SubRegion = Table.AddColumn(RELATED('Account'[SubRegion]))
in

Thanks,

Smitty

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

View solution in original post

4 REPLIES 4
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

As @MarcelBeug has mentioned above, you may mix up DAX (RELATED) and Power Query (Advancd Editor). If you want to use RELATED(DAX) function, you can just use the formula below to add a new calculate column under Modeling tab. Smiley Happy

SubRegion = RELATED ( 'Account'[SubRegion] )

c0.PNG

 

Regards

Anonymous
Not applicable

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

I was looking for this feature as well.  
While noticed that DAX and M have their contexts in which each excels, I got used to RELATED functionality and wanted to use it in M's GetData context. 

Good luck. 

MarcelBeug
Community Champion
Community Champion

You seem to mix up DAX (RELATED) and Power Query (Advancd Editor).

 

In order to add a column from another table in Power Query, use "Merge Queries" from the menu-options.

No need to do this via the Advanced Editor.

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.