Total Aggregation Function in Narrative

Hi all, I am trying to get revenue MoM% for top 3 customers by using Total Aggregation function in narrative, however it reports error, any thoughts? Thank you!

MoM % Growth_v2:
({CM Sales}-{PM Sales})/{PM Sales}, [{sfdc_customer_name}]

Hello @Rachel1, I think the issue may be with TotalAggregate.totalAggregate. You probably need to be doing something like TotalAggregate.metricValue.value. I am not sure if the formattedValue is having an impact on this or not, but that converts it to a string so it may be worth leaving it as a value. Let me know if that helps!

1 Like

@DylanM Thanks for your response, I tried TotalAggregate.totalAggregate.value but it still shows error. Any ideas? Thanks again

Hello @Rachel1, when you used the TotalAggregate function, did you use the Add computation button at the buttom right corner of the Edit Narrative page? When I added it as a computation, I was able to utilize it in my top 3 items return value. The error you are getting is the same one I got when I tried to add it as a code expression without adding the computation. That should give you the solution you are looking for!

1 Like

Hi @DylanM , I confirm that I used Add Computation buttion, it still shows error message above

Hello @Rachel1, I think if that error is still appearing, the issue lies in the field you are attempting to run the TotalAggregation on. If it is that MoM % Growth calculated field, I’d imagine you are getting a mismatched aggregation error (even though that is not how it is displaying). At that point, if you want to display it this way, it will likely require you to run that MoM functionality in your SQL query when you ingest the dataset so the aggregation can occur without errors.