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.
I've tried grouping by both Account ID and Name and generating both to get a better, but still not correct chart as well.
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!
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?