How to GROUP BY a column/s in data studio

16,791

As I said in the comment, I reproduced your query and it worked fine. Here you can see a guide about how to connect BigQuery to DataStudio

Please, notice that DataStudio have some limitations in the query syntax:

enter image description here

If you need further information, please let me know

Share:
16,791
Mengezi Dhlomo
Author by

Mengezi Dhlomo

Updated on June 28, 2022

Comments

  • Mengezi Dhlomo
    Mengezi Dhlomo almost 2 years

    I have a sales table with the purchase history of multiple customers. Needless to say a single customer can appear multiple times in the table. I need to group by the customers and do a count of the industries each customer works in and visualize it in a table in data studio. I need to do all of this in data studio itself.

    In big query the syntax would look something like this:

    SELECT Industry, count(industry) AS industry_count 
    FROM (SELECT 
        CustomerID, 
        Industry 
        FROM `project1.pr.df_full` 
        WHERE  segment = 'Lost'
        GROUP BY CustomerID, Industry)
    GROUP BY Industry
    ORDER BY industry_count DESC
    

    How can I achieve the same thing in data studio? The WHERE clause doesn't have to be there because I have a segment filter on the page I'm trying to do this on

    • rmesteves
      rmesteves about 4 years
      Did you try using your query in DataStudio? I reproduced your query and it seems ok. If you tried, what is the problem?