I have the following M in Power Query to pull data in from Salesforce custom table 'SR__c'. The table has a nested relatinoship table named 'RO__r' as placed in bold below.
When I try to expand the relationship table ('RO__r'), it will not expand and I've tried adjusting data load options as researched here and in the Microsoft community. I really only need two columns from 'RO__r', is it possible to modify the M code below to have Power Query open RO__r and bring in those two columns and do so more expeditiously?
let
Source = Salesforce.Data("https://xxxxxx.salesforce.xxxxxx.com", [CreateNavigationProperties=true]),
SR__c = Source{[Name="SR__c"]}[Data],
#"Removed Other Columns" = Table.SelectColumns(SR__c,{"Name","CreatedDate","SN__c","Customer__c","Customer_Num__c","Vend__c","MRS__c","MRR__c","MS__c","MR__c","QB__c","IS__c","IPS__c","IS__c","IC__c","CPR__c","PGII__c",**"RO__r"**})
in #"Removed Other Columns"
You did not post any indication of what your data looks like, but in general, assuming the first part of your code works, this should expand the contents of the column RO__r if that column contains tables
let Source = Salesforce.Data("https://xxxxxx.salesforce.xxxxxx.com", [CreateNavigationProperties=true]),
SR__c = Source{[Name="SR__c"]}[Data],
#"Removed Other Columns" = Table.SelectColumns(SR__c,{"Name","CreatedDate","SN__c","Customer__c","Customer_Num__c","Vend__c","MRS__c","MRR__c","MS__c","MR__c","QB__c","IS__c","IPS__c","IS__c","IC__c","CPR__c","PGII__c","RO__r"}),
ColumnsToExpand =List.Distinct(List.Combine(List.Transform(Table.Column( #"Removed Other Columns" , "RO__r"), each if _ is table then Table.ColumnNames(_) else {}))),
#"Expanded" = Table.ExpandTableColumn(#"Removed Columns", "RO__r", ColumnsToExpand, ColumnsToExpand)
in #"Expanded"
If you only want to expand two specific columns then
ColumnsToExpand = {"ColumnName1","ColumnName2"},