A system for determining a distinct count for identifiers based on keys, comprising: a processing system that includes one or more processors; and a memory configured to store program code to be executed by the processing system, the program code configured to: access a dataset that includes a plurality of fields; sort the dataset according to the identifiers to generate a sorted dataset, the identifiers being values for a field of the dataset; divide the sorted dataset into a plurality of partitions, each partition of the plurality of partitions being the only partition to include a respective portion of the dataset having at least one subset of identifiers of a first field of the dataset with a same value; provide the partitioned portions of the dataset to a plurality of distributed servers for processing; determine a presence of a key of the keys in the at least one subset on each partition of the plurality of partitions, wherein the key is a value of a second field in the dataset for which counts of values are associated; aggregate a number of instances of the determined presence of the key; and generate a distinct count of values for the identifiers associated with the key. a processing system that includes one or more processors; and a memory configured to store program code to be executed by the processing system, the program code configured to: access a dataset that includes a plurality of fields; sort the dataset according to the identifiers to generate a sorted dataset, the identifiers being values for a field of the dataset; divide the sorted dataset into a plurality of partitions, each partition of the plurality of partitions being the only partition to include a respective portion of the dataset having at least one subset of identifiers of a first field of the dataset with a same value; provide the partitioned portions of the dataset to a plurality of distributed servers for processing; determine a presence of a key of the keys in the at least one subset on each partition of the plurality of partitions, wherein the key is a value of a second field in the dataset for which counts of values are associated; aggregate a number of instances of the determined presence of the key; and generate a distinct count of values for the identifiers associated with the key. access a dataset that includes a plurality of fields; sort the dataset according to the identifiers to generate a sorted dataset, the identifiers being values for a field of the dataset; divide the sorted dataset into a plurality of partitions, each partition of the plurality of partitions being the only partition to include a respective portion of the dataset having at least one subset of identifiers of a first field of the dataset with a same value; provide the partitioned portions of the dataset to a plurality of distributed servers for processing; determine a presence of a key of the keys in the at least one subset on each partition of the plurality of partitions, wherein the key is a value of a second field in the dataset for which counts of values are associated; aggregate a number of instances of the determined presence of the key; and generate a distinct count of values for the identifiers associated with the key.