Solved

Percent of Total from Database

  • 21 September 2021
  • 1 reply
  • 33 views

Hi, I’m trying to get the percentage of total revenue by each of the top 10 Brands (dimension).

 

The logic would be: (Revenue per Brand / Total Revenue)*100. But since it’s the top 10 Brand, if I try to do a table calculation it will not get the global Total Revenue but only the sum of the top 10.

 

I need the Total Revenue considering all the brands from the database, can you help?

icon

Best answer by olga 21 September 2021, 23:25

View original

This topic has been closed for comments

1 reply

Userlevel 1

Hey Vinicius, how exactly you are selecting those top 10 brands? 

We could, for example, not limit the rows (brands), having this way the total for all the brands, sort them accordingly , and then limit the displayed rows in the visualization: 

https://docs.looker.com/exploring-data/visualizing-query-results/table-next-options#limit_displayed_rows

 

Also, you may possibly use the percent_of_total measure https://docs.looker.com/reference/field-reference/measure-type-reference#percent_of_total instead of table calculation