Reputation: 21
My datasets contains the following columns: - person_ID - brand - purchase_date
Now I'd like to use Google Data Studio to create a Dashboard which shows what other brands are purchased by persons who also bought brand X.
with identification as
(
select person_ID
where brand = 'X'
from dataset
)
select count(distinct(data.person_ID)), data.brand
from dataset data
inner join identification ident on data.person_id = ident.person_id
Using Google Data Studio to transform the SQL-code (shown above) in an interactive dashboard solution.
"what other brands are purchased by persons who also bought brand X"
Upvotes: 0
Views: 161
Reputation: 1946
So first you need to get your data into the format you want to present it in. The following SQL should provide data which has every combination of product bought by a customer for example.
SELECT data1.brand brand_purchased, data2.brand other_brands_purchased,
count(distinct(data.person_ID)) uniqueCustomers
FROM dataset data1
INNER JOIN dataset data2 on data1.person_id = data2.person_id
AND data1.brand <> data2.brand
Once you've got the data in a format you need, you'd link that via a connector to data studio.
You can then choose the presentation style you wish to show back to the customer (bar chart, table, etc) and add a filter which has the "brand_purchased" dimension to filter your data by.
It's hard to tell you exactly what to do as there are so many viable solutions depending on how you store your data and how you want to visualise it.
Data Studio's strength is in visualising the data especially to those who aren't data savvy. If you're strong in SQL however, you may find it easier to get to the answers you need through SQL.
Upvotes: 1