Perform Sum of 2 calculated fields

Hello everyone,i have a question on how to create a column for the following analysis,I need both values to add up as the segment increases. where the sum of my two calculated fields (Advanced, Premium) from +1 orders to 16, my problem is that the functions do not accept grouped columns as I mark the output ‘nesting of aggregate functions is not allowed quicksight’, I leave a picture of my table to make it easier to understand the problem, I hope.

Hi @Juan,

Can you show the calculation for your Advanced and Premium fields?

Just so I understand what you’re trying to calculate, what’s your expected result for week 22 and the “1. 0 Orders” segment? Is it 55 + 243?

1 Like

Yes, advanced and Premium are calculated as follows, elements A being an example:
distinct_countIf(
{company_id},
in ({current_segment} ,[‘A’, ‘A1’, ‘A2’, ‘A3’])
)
my expected result, as you say, is 55 + 243, and if possible I would like it to be a cumulative sum until it reaches 4. +16 orders

Sorry, I’m not sure if I’m understanding the issue correctly. If you’re categorizing the companies as Premium or Advanced based on {current_segment} in your calculated field, can’t you just do distinct_count({company_id}) to get the total count across both categories?

1 Like

If I do this calculation, what I get is the count of all users (about 5000 per segment), what I need to do is to make the count, taking into account the users that enter only in the Advanced and Premium categories.

Do you mean that there are other users who are not in Advanced or Premium and you want to exclude them from the total count?

Have you tried combining the conditions for Advanced and Premium in the same calculated field?

1 Like

I did combined, but the cumulative sum from 1 to 16 is something I am not managing to show in the table, (excluding only ‘1. 0 orders’.)

Hello @Juan !

If you have not found a solution for this I would suggest trying distinctcountOver with your partition field being Advanced and Premium.

I am going to archive this topic since it has been open for an extended period of time. If you would still like assistance with this, or if you have a new QuickSight question, feel free to post a new topic in the community so you will be at the top of the priority list for a response from one of our QuickSight experts. Thank you!