Mohit Sharma February 2016

How can I merge output of two queries on two different databases in one single view on Tableau

I am working with two MS-SQL databases and using a query on each database, I am able to get some data in a format which is common for both databases (i.e same column names and datatypes of field values). A brief overview of data is:

Output 1 :

Col1 Col2 Col3
A    1    1
A    2    1
A    1    2

Output 2:

Col1 Col2 Col3
B    2    1
C    3    1
D    1    3 

And I want below data in a single view on tableau:

Col1 Col2 Col3
A    1    1
A    2    1
A    1    2
B    2    1
C    3    1
D    1    3 

I have tried creating a clipboard data source, but the issue came when I tried creating calculated fields based on my previous two data sources. It only permits to have calculated field value as an aggregate value. I want the original value and not the aggregate. Help needed here!

Answers


Sam M February 2016

If the two databases are accessible by a common database user, use a union all to merge the two queries together into one data set. You'll need to write the sql and then create Custom SQL for the database table.

If they aren't accessible by a common database user, look into the possibility of doing linked databases so the db user can see both tables and union.

Post Status

Asked in February 2016
Viewed 1,898 times
Voted 7
Answered 1 times

Search




Leave an answer