Documentation

    Count Dataset

    Count the rows, the columns or both in a table. The result is one row you can check, to confirm that a step kept the number of rows or columns you expect.

    Count a small table

    Manual Input has five people with two columns: name and score. Count Dataset starts with Both selected and produces one row showing rows = 5 and columns = 2.

    The live example needs a desktop screen. The result it produces is shown here, and the explanation and settings below work on any screen.

    Result
    rowscolumns
    52
    1. Choose Rows in Count. The output has just the rows column with a value of 5.
    2. Choose Columns in Count. The output now has just the columns column with a value of 2.
    3. Choose Both in Count to see the two counts together again.

    When to use

    Use Count Dataset to check a table's size, for example to confirm that a Join didn't add or lose rows.

    Read the output

    With Both selected, the output contains one row with rows set to 5 and columns set to 2. Those values describe the table supplied by Manual Input.

    The name and score columns are replaced by the counts in this block's output. The original input table is unchanged. Choosing Rows or Columns changes which count you get. There's always one output row.

    Read preview counts correctly

    This example is small enough for all five rows to be included in the preview. With a preview row limit selected, the editor works with sampled upstream data, so a preview row count may be smaller than the full input.

    Run the full flow to count every row reaching Count Dataset. The column count comes from the input schema, so it counts columns rather than filled cells.

    To count rows separately for each group, use Summarize.

    Inputs and outputs

    Inputs

    1 port
    InRequired

    Accepts: Tables, Geospatial data.

    Accepts one connection on this port.

    Outputs

    1 port
    Out

    Configure the block

    Choose which dimensions of the input table to count.

    Count

    Rows produces a rows column; Columns produces a columns column; Both includes both counts. The output always contains one row. Row count in preview is based on the selected upstream preview sample. Full run counts every row. Default: Both.

    Count Dataset FAQs

    Do rows with missing values count?
    Yes. Every input row counts, including Noor's row with a NULL score. The row count is 5, not 4. Columns also count even if every value in them is NULL.
    What happens with an empty input table?
    Count Dataset still produces one output row. The row count is 0, and the column count is the number of columns in the input table.
    Does Count Dataset count distinct values?
    No. Duplicate rows count separately. Count Dataset measures the table's row and column counts, not the number of unique values.
    Why is the output preview only one row?
    That row holds the counts. The rows column gives the number of input rows. The preview's own row count describes the one-row result.

    Prepare your data. Build it in Strata.

    Strata opens in your browser, with no account.