Gofrette
Gofrette

Reputation: 478

How to chart two metrics from aggregated table in Looker?

I am trying to make a line chart with two metrics vs date. I am querying an already aggregated table. When I add three columns to the visualization, date and 2 numeric fields and pick scatter plot or line chart, only two numeric fields are charted. I want to be able to chart date as X axis and two numeric fields as line chart.

Is there a way to chart two numeric dimensions in one chart without aggregation?

Upvotes: 0

Views: 1466

Answers (1)

Anita Hb
Anita Hb

Reputation: 126

You need to have one dimension, which is the date, and two measures with type:number (because you don't need any aggregation)

  measure: total_amount {
    type: number
    sql: ${pre_aggregated_total_amount} ;;

  measure: product_count {
    type: number
    sql: ${pre_aggregated_product_count} ;;

Also, in the line chart option, you will be able to drag one measure to the left axis and the other one to the right axis if you want.

enter image description here

Upvotes: 1

Related Questions