Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi There
I'm trying to create some relationships between some sales pipeline data and plan data from excel but I'm getting the following error:
"You can't create a relationship between these two columns because one of the columns must have unique values"
The SFDC Data table is a report from SFDC so I can't amend any of the fields
Opportunity Name | Account Name | Opportunity Record Type | Region | Fiscal Period | Close Month | Amount |
Random Name A | Customer A | Y | EMEA 1 | Q4-2016 | 9/1/2016 | 200 |
Random Name B | Customer A | Y | EMEA 2 | Q1-2017 | 12/1/2016 | 500 |
Random Name C | Customer B | Z | NA 2 | Q1-2017 | 11/1/2016 | 700 |
Random Name D | Customer C | Z | NA 1 | Q1-2017 | 10/1/2016 | 1000 |
The plan data is manually updated in excel so I can amend this in anyway necessary.
Month | Opportunity Record Type | Region Group | Period | Plan Amount |
9/1/2016 | Y | NA | 2016-Q4 | 800 |
10/1/2016 | Y | NA | 2017-Q1 | 900 |
11/1/2016 | Y | NA | 2017-Q1 | 1000 |
12/1/2016 | Y | NA | 2017-Q1 | 1100 |
9/1/2016 | Y | EMEA | 2016-Q4 | 800 |
10/1/2016 | Y | EMEA | 2017-Q1 | 900 |
11/1/2016 | Y | EMEA | 2017-Q1 | 1000 |
12/1/2016 | Y | EMEA | 2017-Q1 | 1100 |
9/1/2016 | Z | NA | 2016-Q4 | 1000 |
10/1/2016 | Z | NA | 2017-Q1 | 1000 |
11/1/2016 | Z | NA | 2017-Q1 | 800 |
12/1/2016 | Z | NA | 2017-Q1 | 900 |
9/1/2016 | Z | EMEA | 2016-Q4 | 1000 |
10/1/2016 | Z | EMEA | 2017-Q1 | 1100 |
11/1/2016 | Z | EMEA | 2017-Q1 | 800 |
12/1/2016 | Z | EMEA | 2017-Q1 | 800 |
I also have two mapping tables
This mapping table groups the Region in to the Region Group that I want to display
Region | Region Group |
EMEA 1 | EMEA |
EMEA 2 | EMEA |
NA 1 | NA |
NA 2 | NA |
This mapping rearranges the Fiscal Period so that it shows in chronological order in charts
(also note that the quarters we have use September as the start of Q1)
Fiscal Period | Period |
Q4-2016 | 2016-Q4 |
Q1-2017 | 2017-Q1 |
I have successfully linked the mapping tables to the SFDC file and built a report sucessfully. However, when I try to link the SFDC and Plan tables I get the error message.
I want to be able to slice the data by Opportunity Record Type, Region, Month and Fiscal Period so that both Plan and SFDC numbers update.
Any help would be greatly appreciated and if there is any way to improve what I've already done then that would also be great.
Thanks
Paul
Solved! Go to Solution.
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
Hi There,
Please follow this blog post by Jeffery Wang for Handling of the Complex relationships. It will show you how to handle that error message you are getting.
Thanks & Regards,
Bhavesh
Thanks for the response
But, I'm having difficulty applying the second example in the link that you gave to my problem.
I think that this is because I have 2 different fields that I want to slice the data with, both the month and Opportunity Type. If I merge using one then the other doesn't match. I might be trying this incorrectly.
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.
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 method worked for the dataset that I provided which was intended to be a small samle.
When I add lines to the data I get the following message
"Column 'Region' in Table 'table1' contains a duplicate value 'EMEA 1' and this is not allowed for the columns on the one side of the many-to-one relationship or for the columns that are used as the primary key of the table.
Also, when I added new lines to the table which did not violate the above rule, It duplicated the plan amount for each of the lines, meaning that if I sum them up it give me a higher number than intended. How do I then only calculate the unique values of my original plan?
This worked just as intended.
Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
97 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |