Working with Data: All the calculations you need t
  • Introduction
  • What is this book?
  • How to Use this Book
  • Document Notes
  • Authors' Thanks
  • Strings
    • Concatenate
    • Split
    • Length
    • Slice
    • Trim
    • Contains
    • Match
    • Replace
    • Upper/Lower Case
  • Numbers
    • Sum
    • Average
    • Roll Ups
    • Round
    • Floor
    • Power
    • Square Root
    • Absolute
  • Dates
    • Date Difference
    • Age
  • Logical
    • Logical Operators
    • If
    • Case / Switch
    • Is Null/Empty
  • General
    • Count
    • Filter
    • Sort
    • Lookup/Join
    • Variables
    • Convert Type
  • Appendix
    • DateTime Parts
    • Helpful Resources
Powered by GitBook
On this page
  • Excel
  • Tableau
  • Alteryx
  • OrgVue
  • tSQL
  • Python

Was this helpful?

  1. Numbers

Average

PreviousSumNextRoll Ups

Last updated 5 years ago

Was this helpful?

Whilst some tools will let you calculate other types of average, like Median or Mode, most will default to displaying the Mean average, i.e. the sum of a set of numbers divided by how many numbers there are.

In most cases, this will be the average within a field of numerical data, though you might also want to average a filtered subset of numbers or a list of numbers provided by you, e.g. as an array [2,7,8,3]. All the average functions below will allow you to choose either a set of numerical values or specify your own.

Excel

=~AVERAGE!~(‹number_array›) =~AVERAGE!~(‹number1›«, number2», «numberN»)

=AVERAGE(A:A)
// OR
=AVERAGE(2,7,8,3) // Returns 5

NB. If you want to calculate the Median or Mode average, you can do so using: =~MEDIAN!~(‹number1›«, number2», «numberN») =~MODE!~(‹number1›«, number2», «numberN»)

Tableau

~AVG!~(‹measure›)

AVG([Bonus])

Alteryx

Use the Summarize tool (in the Transform palette):

(group by field, average by measure).

OrgVue

‹measure›.~avg!~; ‹number_array›.~avg!~;

nodes().bonus.avg;
// OR
array(2,7,8,3).avg // Returns 5

tSQL

~AVG!~(‹measure›)

SELECT AVG(Profit)
FROM SalesData

Python

numpy.~mean!~(‹number_array›)

import numpy

numpy.mean([2,7,8,3]) # Returns 5.0

NB.:

  • This requires the numpy library to be imported.

The above example assumes a variable has been declared for profit. For more information, go to .

General > Variables