dougtrajano
New Contributor III

Thank you for your response.

I want to calculate the market share. To do so, I must divide each row value by the sum of the "acessos" column.

I was able to do that in the query using an window function.

 

sum(acessos) / sum(sum(acessos)) OVER () AS market_share

 

However, including that in the query limits the type of filter I can use. I would like to use the "Field" filter type so the filters can dynamically reflect column values. If I add this expression to the query, I can only use the "String," "Numeric," and "Date" types. The "Query Based Dropdown List" option, which is available in the SQL Editor, is not accessible in the AI/BI Dashboard.

Description of what I am trying to calculate

I am creating a Dataset in the AI/BI Dashboard, this dataset returns two columns and applied several filters in a given UC table. The columns are:

  • company: The name of the company.
  • sum(views) AS total_views: The count of views.

I would like to calculate the market_share based on total_views column in a way that I can change the Dashboard Filters and it reflects to the market_share calculation.