Error: A selection can only be created for a query containing an aggregate when the query's primary key field is included in the output.

When attempting to save a selection for a query, the below message appears:

"A selection can only be created for a query containing an aggregate when the query's primary key field is included in the output."

For example, you are under Analysis > Query and have added a new query. On the Set Save Options tab you have checked the box, "Save a selection" and then the error occurs after clicking "Save."
To resolve the issue, add the "Primary key" field to the output of the query results. First open your query to edit, then follow the below steps to add the Primary keys to your results:

Constituent Query
  1. In the left column, select Constituents. From the middle column, drag Constituent record into Results fields to display.
  2. On the Set Save Options tab, attempt to save the query and Create a selection again

Revenue Query
  1. In the left column, select Revenue. From the middle column, drag Revenue record into Results fields to display
  2. On the Set Save Options tab, attempt to save the query and Create a selection again

Sales Orders Query
  1. In the left column, select Sales Orders. From the middle column, drag Sales order record into Results fields to display.
  2. On the Set Save Options tab, attempt to save the query and Create a selection again

Environment

 2.92
Warning
Maintenance in Progress: During this period, you can view your data, but you can’t add, edit, or delete data.

Was this article helpful?