I'm a SAQL beginner and I'm currently trying to modify an errant dashboard in Einstein Analytics that I did not create. The dashboard contains a step that currently groups by Account Name and sums the Amount field of Opportunities associated with each Account. The query is as follows:

q = load "opportunities";
q = group q by 'AccountId.Name';
q = foreach q generate 'AccountId.Name' as 'AccountId.Name', sum('Amount') as 'sum_Amount';

This works, but has a crucial problem; Account Name is not unique. So this will group different Accounts together and sum both of their related Opportunity Amounts. My thought was to use Account ID instead, but this obviously causes the chart itself to display an ID on the y-axis.

Sum of Amount by Account Id

I've tried grouping by both Account ID and Name and generating both to get a better, but still not correct chart as well.

Sum of Amount by Account Id and Name

My final attempt was to group by Account ID and Name, but only generate the Account Name. The query:

q = load "opportunities";
q = group q by ('AccountId', 'AccountId.Name');
q = foreach q generate 'AccountId.Name' as 'AccountId.Name', sum('Amount') as 'sum_Amount';

This seems to work perfectly for the values table, but the chart itself just omits the second Account Name!

Account Name by Sum of Value Table Account Name by Sum of Value Chart

This doesn't seem like something that should be this difficult, so I'm hoping there's an easy explanation for what I'm doing wrong here. Is there an easier/working way to display a field on the axis that is different from the field that was grouped by?


I just recreated your problem. It seems, that the graphs in Einstein Analytics just are not able to show multiple items for the same grouping. So either you have to generate a unique grouping criteria ( e.g. AccountName + "("+AccountID+")" ) or add a second grouping to make all rows unique.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.