The problem I’m having is how to join Join Multiple Views that are inside different datasets in the Big Query
The context of why I’m trying to do this Join Multiple Views that are inside different datasets in the Big Query
When I am joining using the ref function that is coming from the different Datasets I am getting the error the following are the views {{ ref(‘Search_Console_Data’) }} and {{ ref(‘time_level_web_analytics’) }}
I am getting the error the frrst refereed views is not inside the datset but In actual the view is in the different dataset from my secound view and I have already created it
With Unique_table As (
SELECT Distinct *, Concat(date,url,country) As UID FROM (
SELECT date, url, country FROM {{ ref('time_level_web_analytics') }}
UNION ALL
SELECT data_date As date,url,country FROM {{ ref('Search_Console_Data') }}
)
),
Analytics AS (
SELECT date, url, country, sUM(Total_Users) As Total_Users,Sum(New_Users) As New_Users,Sum(Total_Sessions) AS Total_Sessions,Sum(Total_Views) As Total_Views,Sum(engaged_Sessions) As engaged_Sessions,Sum(key_event) As Conversions,Concat(date,url,country) As UID FROM {{ ref('time_level_web_analytics') }}
where session_duration_seconds > 2 and source != "urlumbrella.com"
Group by date, url, country
),
Console As (
SELECT data_date, url, country,SUM(impressions) As impressions,Sum(clicks) AS clicks,Concat(data_date,url,country) As UID FROM {{ ref('Search_Console_Data') }}
GROUP BY data_date, url, country
)
SELECT ut.date,ut.country, ut.url, A.Total_Users,A.New_Users,A.Total_Sessions,A.Total_Views,A.engaged_Sessions,A.Conversions,CS.clicks,CS.impressions, (CS.Clicks/CS.impressions) As CTR FROM Unique_table UT
LEFT JOIN
Analytics A
ON UT.UID = A.UID
LEFT JOIN
Console CS
ON UT.UID = CS.UID