Insights Narrative - Count and Sum of Function

I currently have an Insight where it shows the top ranked $$ of sales as of today. However, I want the insight to show the volume of sales along with the dollar amount for my category (region). Any assistance would be appreciated.

Hi @strellis,
Do you have a field already setup for volume of sales as well? Make sure to add that field to your insight visual field well as well (it accepts multiple values so that they can be utilized in the insight).
How do you envision it looking for the layout?

1 Like

Hi @strellis,
It’s been awhile since we last heard from you, checking back in to see if you have any additional questions?
If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

Hi Brett, yes I have a field already set up for volume. The issue is that the only way I add it is through another computation. So it is giving me the top 20 by volume and top 20 by sales amount. However, that does not match (Region A has a volume of 5 for $20K while Region B has a volume of 12 for $16K). So with the two computations on the two fields, it is telling me Region A has a volume of 12 for $20K and Region B has a volume of 5 for $16K.

Hi @strellis,
Understood! There are a few steps needed to achieve this as it’s not something an insight has the capability of doing easily. You’ll need to create a couple different calculated fields, the process should be something like below (the dataset I’m using as an example is different so you may want to change the fields you’re setting this up by to match your data):

First, you’ll want to setup a Rank for your sales:

  • Choose how you’d like to rank your sales (for this I did by ‘Product’)
    Sales By Product: sumOver({Sales}, {Product}, PRE_AGG)

  • Then create your ranking:
    Rank Sales by Product: denseRank([{Sales by Product} DESC], [ ], PRE_AGG)

Next, you’ll want to create another calculated field for each volume ranking (if you’re doing Top 3, you’ll need 3 different calc. fields)
Rank 1 Volume: sumOver(ifelse({Rank Sales by Product} = 1, {Quantity}, NULL), [ ], PRE_AGG)

You can then add those 3 calc. fields to your insight to provide the volume for each so that they match your Sales ranking.

Let me know if you have any additional questions!

2 Likes

This makes sense and makes sense in my mind! Will give it a try, but at a high level, it makes logical sense. Thank you!

1 Like