Search code examples
error-handlinggoogle-bigquerylocationdatasetbigdata

How can I solve the error "Dataset was not found in location US" in BigQuery?


I'm trying to run some tests with Google BigQuery to calculate data from my Google Spreadsheets. When trying to run the code, I am getting the error: "Dataset was not found in location US".

I have already tried processing the site in "Automatic" or "EU" in the query settings but neither of each has brought any useful results.

The code I used is this one here:

SELECT a.Customer AS Customer,
       round(100.00*sum(b.Online_Sales)/sum(a.Sales), 2) AS PctOnlineSales
FROM
    Dataset.Big_Data_Test_1_Sales a
JOIN
    Dataset.Big_Data_Test_1_Online_Sales b
ON a.Customer = b.Customer
--WHERE a.Customer IN ('1002')
GROUP BY 1
ORDER BY 1

I expected to multiply the data of two sheets that are schemed in my dataset.

Can you guys help me fix the location issue?

Thanks in advance! Nes


Solution

  • Add your project Id before the dataset so BigQuery can locate it. This is an example based on your code

    SELECT a.Customer AS Customer,
           round(100.00*sum(b.Online_Sales)/sum(a.Sales), 2) AS PctOnlineSales
    FROM
     ProjectId.Dataset.Big_Data_Test_1_Sales a
    JOIN ProjectId.Dataset.Big_Data_Test_1_Online_Sales b
    ON a.Customer = b.Customer
    --WHERE a.Customer IN ('1002')
    GROUP BY 1
    ORDER BY 1```