Question

Grouping or Summarizing not happening

  • 14 September 2021
  • 3 replies
  • 25 views

Hi All,

 

I have single view with 10 columns . When I try to make a visualization by taking one string( category) and number(SalesValue) columns, looker is not summarizing data. Its pulling all the records as a table with duplicate category values and same is appearing in visual.

Ideally. If I have 5 categoires, the visual also should show 5 columns with respective sales value.

Kindly suggest.

Thanks in Advance


3 replies

Userlevel 1

Hey Durga!

You are selecting Category and SalesValue in your explore, only these 2 fields, correct? 

Is SalesValue a measure or a dimension? 

As I can understand from your description, Category and SalesValue should be columns in your database table, so if you want your Sales Values to be grouped by category, they would need to be aggregated. Something like

measure: total_sales_value {
type: sum
sql: ${TABLE}.salesvalue;;
}

Then when you select dimension Category and measure Total Sales Value you will have one row per Category

Hi Olga,

Thanks for the quick reply.

When I use measure as mentioned above, I am getting same number across all the categories. 

Please suggest.

 

Thank You,

Userlevel 1

and how does your generated SQL query look like? Should be something like this:

SELECT category, sum(salesvalue) FROM that_table GROUP BY category SORT BY sum(salesvalue)

Reply