[Solved] SAQL to generate a field not in a group by statement

Timestretch Asks: SAQL to generate a field not in a group by statement
I’m a bit of a beginner to SAQL. I have been tasked with maintaining a fairly elaborate dashboard and data flow and have been asked to add some features to it. There is a lens that displays a chart in which I need to pull another field in order to display it in a tooltip. However, the SAQL side of it includes a group by statement and I’m running into some issues adding the new field to the generate statement.

Code:
q = load "main_data_set";
q = group q by ('Value_Name__c', 'TeamMemberName');
q = foreach q generate 'Value_Name__c' as 'Value_Name__c', 
'TeamMemberName' as 'TeamMemberName', sum('Value__c') as 'sum_Value__c', 
sum('Value_Index__c') as 'sum_Value_Index__c', 'NEW_FIELD__c' as 
'NEW_FIELD__c'; 
q = order q by 'sum_Value_Index__c' asc;
q = limit q 20000;

When I added NEW_FIELD__c to the generate statement, I get the following error when trying to run the query:

Non grouped dimension in a grouped query: 'Annotation__c'

It runs fine when I add NEW_FIELD__c to the group by statement, but I don’t want the data grouped by this field, I just want to be able to access it in the graph configuration. What am I doing wrong?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.