Skip to main content

Issues

Completed

List.Count returns 1 for empty tables in Table.AggregateTableColumn

Vote (1) Share
Marcel Beugelsdijk's profile image

Marcel Beugelsdijk on 20 Jan 2017 14:33:54

When aggregating a table column with nested tables, count returns the number of records in the nested tables.
However, if a nested table is empty, 1 is returned instead of 0.

The generated code for aggregation is for example:
Table.AggregateTableColumn((Table1,"Tables", {{"Order",List.Count, "Count of Order"}})

As a workaround, List.Count can be replaced by List.NonNullCount.

Strange enough and likewise, List.Count in combination with Table.TransformColumns, returns 0 for empty nested tables, e.g.
Table.TransformColumns((Table1,{{"Tables", each List.Count(_[Order]), type number}})

Comments (1)
Marcel Beugelsdijk's profile image Profile Picture

ac643e7c e800-ea11-a811-000d3a4f1ebb on 05 Jul 2020 22:38:39

RE: List.Count returns 1 for empty tables in Table.AggregateTableColumn

Have passed this along to the team.