问题
How do we merge two queries in power bi when the primary key is a combination of 2 columns.
for example i have 2 tables
Table A :
year
cost center
col a
col b
col c
Table B:
year
cost center
col x
col y
col z
The primary key in both the columns is a combination of the 1st two columns. How do i merge these two queries?
回答1:
When you merge the queries using the GUI, you can hold down Ctrl
to select multiple columns from each table. (Make sure you select them in the same order on both tables.)
回答2:
- Either create a new combined column from year and cost center (in one table this key has to be unique) and use this new key for your relationship
- Or merge both tables into a new table and than you can pick multiple columns to join on.
来源:https://stackoverflow.com/questions/61499573/how-to-merge-queries-in-power-bi-with-2-primary-keys