Question

how to sum more than one dimension at looker?

  • 4 November 2021
  • 2 replies
  • 28 views

HI,

 

I need to SUM more than one dimension in a looker view. How can I do that?

 

I need to create a measure who is the sum of these three dimensions


2 replies

Userlevel 1

Hi @Bruna ,

If you are putting this value on a report, adding a table calculation is possible.

Just add a table calculation under the custom fields tab when building a report.

 Then insert the fields you want to sum like so.

Hope this helps!

Userlevel 1

 

Hi Bruna,

 

One way to achieve a sum of dimensions is by using looker - Table calculations .

The prerequisites of the dimensions is : all dimensions that are included in the sum must contain 

type:number .

 

 

 

 

For instance:

 dimension: training_duration_two {
type: number
sql: ${TABLE}.training_duration_two ;;
}

dimension: training_duration_two_minutes {
type: number
sql: CAST(trim(${TABLE}.training_duration_two) AS INTEGER) ;;
}
dimension: training_duration_three {
type: number
sql: ${TABLE}.training_duration_three ;;
}

 

 

After saving lookML changes, you need to add the table calculation needed:

 

 

 

 

The following menu will appear, in this box the sum is created by indicating the dimensions you want to sum:

 

 

After creating the new table calculation, the output will create a green column (green color column indicates that it is a table calculation column)

 

 

Regards,

Leo

Reply