COUNTROWS

The COUNTROWS function counts the number of rows in a table.

Syntax

COUNTROWS(
    <table>
)

Parameters
  • table: Name of the table whose rows we want to count or expression that returns a table.
Returned value

The COUNTROWS function returns an integer.

Additional Information

If the table does not contain any rows, a BLANK value is returned. It should be noted that, for the calculation, the function is contextualized. That is, it does not calculate, in the strict sense of the term, the number of rows in the table, but rather the number of rows in the table once the corresponding context is applied to it.

Examples

In this example we want to know the number of rows contained in the FactSales table, for which the following measure is defined:

NumVentas = COUNTROWS(FactSales)

If the result is shown in a "card" type display, we get the following:

COUNTROWS function: Example of use

If we have in FactSales a list of sales (each row corresponding to a sale) and we define the following measure:

Nº de ventas = COUNTROWS(FactSales)

...we can create a matrix to take the years and the newly created measure to. As seen in the following image, the measure is contextualized for each year:

COUNTROWS function. Example of use

Category
Statistical
Submitted by admin on Tue, 12/04/2018 - 12:11