Hi,
In this post, you would see how to connect to foodmart database and query the database
from Tableau Desktop
Tableau Version : 2018.1
See below video tutorial (View directly in YouTube with 720p HD quality)
Link : https://www.youtube.com/watch?v=GhGxzfXdlIk
1) Click on Show Start Page once you open the Tableau Desktop
2) From the left side "Connect" pane select Postgresql and then provide the database connection strings in the poped up window as shown in below image.
3) Click on Sign In button to navigate to the query designer window.
4) Double click on New Custom SQL from the left side panel to open the "Edit Custom SQL" window.
5) Write below query and click on preview button.
SELECT t.the_date,
SUM(sf7.unit_sales) unit_sales,
SUM(sf7.store_sales) store_sales
FROM sales_fact_1997 sf7
LEFT JOIN time_by_day t ON sf7.time_id=t.time_id
LEFT JOIN customer c ON sf7.customer_id=c.customer_id
WHERE t.the_year=2012 AND c.state_province='CA'
GROUP BY t.the_date
ORDER BY t.the_date
This is how you can connect to a database and query it using tableau desktop.
Thank you
Sadakar Pochampalli
In this post, you would see how to connect to foodmart database and query the database
from Tableau Desktop
Tableau Version : 2018.1
See below video tutorial (View directly in YouTube with 720p HD quality)
Link : https://www.youtube.com/watch?v=GhGxzfXdlIk
1) Click on Show Start Page once you open the Tableau Desktop
2) From the left side "Connect" pane select Postgresql and then provide the database connection strings in the poped up window as shown in below image.
3) Click on Sign In button to navigate to the query designer window.
4) Double click on New Custom SQL from the left side panel to open the "Edit Custom SQL" window.
5) Write below query and click on preview button.
SELECT t.the_date,
SUM(sf7.unit_sales) unit_sales,
SUM(sf7.store_sales) store_sales
FROM sales_fact_1997 sf7
LEFT JOIN time_by_day t ON sf7.time_id=t.time_id
LEFT JOIN customer c ON sf7.customer_id=c.customer_id
WHERE t.the_year=2012 AND c.state_province='CA'
GROUP BY t.the_date
ORDER BY t.the_date
This is how you can connect to a database and query it using tableau desktop.
Thank you
Sadakar Pochampalli


No comments:
Post a Comment