Skip to content

Commit

Permalink
Added average metric AVG() to default metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
vera-liu committed Oct 25, 2016
1 parent 7c59337 commit ba2a2e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,13 @@ def fetch_metadata(self):
metric_type='sum',
expression="SUM({})".format(quoted)
))
if dbcol.sum:
metrics.append(M(
metric_name='avg__' + dbcol.column_name,
verbose_name='avg__' + dbcol.column_name,
metric_type='avg',
expression="AVG({})".format(quoted)
))
if dbcol.max:
metrics.append(M(
metric_name='max__' + dbcol.column_name,
Expand Down

0 comments on commit ba2a2e5

Please sign in to comment.