Forum Discussion
Joining multiple tables/queries
- 8 years ago
Hi lukaspowerbi
Sorry for the late reply. Did you get this one sorted?
I'm guessing there is a subtle difference in the spelling, or even a rogue space that needs to be cleaned for an exact match
Hi Phil_Seamark
I am not sure what's easier to explain so that I can accomplish this whether dax or merging queries.....
I am not sure if merging queries solves the problem. Can you give me an example of how to merge let's say two tables/queries?
In both tables there are countries that may not be in another table.
Country Members
Canada 50
USA 80
UK 40
Brazil 20
Country Joins
Canada 20
USA 30
UK 25
Australia 10
My desired output is to combine all countries in both columns:
Country Members Joins
Canada 50 20
USA 80 30
UK 40 25
Brazil 20 0
Australia 0 10
Member IDs per country is the formula (2 columns)
Hope it makes sense.
- Phil_Seamark8 years agoMicrosoft Employee
HI lukaspowerbi,
In the Query Editor, I created the following two tables.
Table1
and Table2
I then chose the Merge Queries as New option
I then configure the Merge dialog as follows. Be sure to click the Country column in bot tables.
In the newly created table, click the "expand columns" button in the top right hand corner
Configure the dialog as follows and click ok
Now add a new column to combine the two contry fields as follows
Delete the 1st and 3rd columns ("Country" and "Table2.Country"), and rename the 5th column from "Custom" to "Country".
Highlight the 1st and 2nd columns and use the Replace Values function on the Home table to convert nulls to zeros.
Then rename, and reorder your columns and you are good to go.
- lukaspowerbi8 years agoHelper II
Hi Phil_Seamark.
You have been a great help. Thank you!!!I have one more thing that I would like to ask you about if there is a way to do some work around.
I added a custom column and replaced null values from the first Country column by values in the 5th column.
However, there is Papua New Guinea that causes a bit issue. I attached a screenshot where I highlighted the issue in the pic below.- Phil_Seamark8 years agoMicrosoft Employee
Hi lukaspowerbi
Sorry for the late reply. Did you get this one sorted?
I'm guessing there is a subtle difference in the spelling, or even a rogue space that needs to be cleaned for an exact match