Forum Discussion
Trouble Creating Relationships
- 9 years ago
Is there a way to add the rows of the Plan data to the SFDC data so that the Opportunity Record Type, Region and Month all align and add new column for the Plan amount? I think I could slice the data correctly then.
Yes, there is. But since you need to slice the data with columns like Opportunity Record Type, Region and Month, you need to relate these two tables based on all common columns (Month, Record Type, Region and Period) like a composite key. You can use Merge query to get the full match records. See my sample below.
I assume you have tables like below.
SFDC
Plan
1. Use the query below to add two columns(Region Group and Period) for SFDC table in Advanced Editor of Edit Queries.
#"Added Custom" = Table.AddColumn(#"Changed Type", "Region Group", each List.First(Text.Split([Region]," "))), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Period", each List.Last(Text.Split([Fiscal Period],"-")) & "-" & List.First(Text.Split([Fiscal Period],"-")))
2. Use the query below to Merge Plan table and SFDC table in Advanced Editor of Edit Queries.
#"Merged Queries" = Table.NestedJoin(#"Changed Type",{"Opportunity Record Type", "Region Group", "Period", "Month"},SFDC,{"Opportunity Record Type", "Region Group", "Period", "Close Month"},"NewColumn",JoinKind.LeftOuter), #"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"Opportunity Name", "Account Name", "Amount"}, {"NewColumn.Opportunity Name", "NewColumn.Account Name", "NewColumn.Amount"})3. After click Close&Apply , you will get the Merged Plan table like below.
4. Then you should be able to use Opportunity Record Type, Region, Month and Period to slice the data.
Regards
Is there a way to add the rows of the Plan data to the SFDC data so that the Opportunity Record Type, Region and Month all align and add new column for the Plan amount? I think I could slice the data correctly then.
Yes, there is. But since you need to slice the data with columns like Opportunity Record Type, Region and Month, you need to relate these two tables based on all common columns (Month, Record Type, Region and Period) like a composite key. You can use Merge query to get the full match records. See my sample below.
I assume you have tables like below.
SFDC
Plan
1. Use the query below to add two columns(Region Group and Period) for SFDC table in Advanced Editor of Edit Queries.
#"Added Custom" = Table.AddColumn(#"Changed Type", "Region Group", each List.First(Text.Split([Region]," "))), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Period", each List.Last(Text.Split([Fiscal Period],"-")) & "-" & List.First(Text.Split([Fiscal Period],"-")))
2. Use the query below to Merge Plan table and SFDC table in Advanced Editor of Edit Queries.
#"Merged Queries" = Table.NestedJoin(#"Changed Type",{"Opportunity Record Type", "Region Group", "Period", "Month"},SFDC,{"Opportunity Record Type", "Region Group", "Period", "Close Month"},"NewColumn",JoinKind.LeftOuter),
#"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"Opportunity Name", "Account Name", "Amount"}, {"NewColumn.Opportunity Name", "NewColumn.Account Name", "NewColumn.Amount"})3. After click Close&Apply , you will get the Merged Plan table like below.
4. Then you should be able to use Opportunity Record Type, Region, Month and Period to slice the data.
Regards
This worked just as intended.
Thanks!