COUNT()

Number of list items

Returns the number of items in the list.

Sample usage

COUNT(Products[Color]) : The total number of (possibly duplicate) values in the Color column of the Products table. Equivalent to COUNT(SELECT(Products[Color], TRUE, FALSE)). See also: SELECT()

COUNT(SELECT(Products[Color], TRUE, TRUE)) : The total number of non-duplicate values in the Color column of the Products table.

COUNT(SELECT(Products[Color], IN([Color], {"Red", "Orange"}))) : The total number of (possibly duplicate) values in the Color column of the Products table where the Color column value is either Red or Orange. See also: IN()

COUNT(Orders[_RowNumber]) : The total number of rows in the Orders table. Note that this is not equivalent to MAX(Orders[_RowNumber]), which doesn't account for empty (e.g., deleted) rows or a spreadsheet header row.  See also: MAX()

COUNT([Discounts]) returns the count of the items in the Discounts column value, where Discounts is of type List.

COUNT(LIST("Red", "Yellow", "Green")) returns 3

COUNT(LIST()) returns 0

COUNT(LIST("")) returns 1

Count select rows

Count orders with special delivery instructions that occur within a reporting period:

COUNT(
  FILTER(
    "Orders",
    AND(
      ISNOTBLANK([Special Instructions]),
      ([Date Done] >= [_THISROW].[Begin Date]),
      ([Date Done] < [_THISROW].[End Date])
    )
  )
)
  • FILTER("Orders",  ...) gets a list of row references (values of the key column)  for select rows in Orders.
  • AND(..., ..., ...) limits the results to only those rows that match all of the conditions.
  • ISNOTBLANK([Special Instructions]) ensures only rows that contain special delivery instructions are counted.
  • ([Date Done] >= [_THISROW].[Begin Date]) limits the count to only rows with a Date Done column value no earlier than the report's Begin Date column value.
  • ([Date Done] < [_THISROW].[End Date]) further limits the rows to those with dates before the report's end date.
  • COUNT(...) counts the number of items selected.

See also: AND(), FILTER(), ISNOTBLANK()

Common problems

COUNT(1, 2, 3) - In this example, the arguments are not in list form. To fix, wrap them in LIST() to construct a list: COUNT(LIST(1, 2, 3)).

Syntax

COUNT(list)

  • list - List of any type.

See also

AVERAGE()

MAX()

MIN()

STDEVP()

SUM()

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Main menu
13016923969299691432
true
Search Help Center
true
true
true
false
false