Creating a Cumulative visual

Scenario: i own a shop which is selling types of fruits. currently, the options are apple and banana. i have a field named resultdesc, which tells me if the person wants an apple or banana. i have created a calculated field named resultdesc_count to change this into an integer, by assigning it to either 1, or -1. using this, how can i create a cumulative graph which tells me the cumulates the results over days so i can see how its growing. i also want this to be in 2 colours, to represent apple and banana.
so if day 1 i sell 15 bananas and 12 apples, day 2 i sell 5 apples and 2 bananas, and day 3 i sell 12 apples, 17 bananas, it should display:
Day 1: 27
Day 2: 34
Day 3: 63
however colour coded to type of fruit

code to resultdesc_count:
ifelse(ResultDesc = ‘Apple’, 1, ifelse(ResultDesc = ‘Banana’, -1, 0))

Hi @HarveyB-B
Can you please share the columns in your dataset? you can also explore, runningSum function. If you can list columns, it will be easy to suggest the appropriate formula.


this is what i looks like, added a new fruit named cherry aswell. it is simple but as someone who is knew to quicksight, i do not know how to cumulate visuals with quicksight.
Hope this helps, if not please reply with anything else you need


the data is stored in tmp_fruit_stack

this is the code for it:
ifelse({flag_Banana}=1, “Banana”,{flag_Apple}=1 , “Apple”, {flag_Cherry} = 1, “Cherry”, “Other”)

the flag_banana flag_apple etc is the calculated field which flags from the database what they ordered.
Here is the code for it (same concept for the other flags aswell):


was there any updates on the appropriate formula for this? have been playing around but cant find anything which works


Hi Vetri, not sure if you’ve seen my replies. i did attach an image of what it looks like. Just checking on an update for a solution.


Hello @HarveyB-B, my apologies for the delayed response, is this an issue you are still trying to fix? I am a little confused because the image you posted above looks like it is displaying the graph you are wanting to show.

With the stacked bar chart visuals, you are able to show the groupings by number or percentage. So it could display the number of apples and bananas each day, or the percent of apples and bananas of the total number sold for that day. You could also use the detailed tooltip option on the format visual to try displaying the total number of fruit sold that day, with the numbers of each fruit broken down.

Another thing to note, if your field resultdesc returns only a single fruit value, like “Apple”, “Banana”, or “Cherry”, then you will not need to do much aggregation. You would want your date field as the x-axis. The y-axis could be a calculated field like this:
ifelse(isNotNull({resultdesc}), 1, 0), that way each time a fruit name is populated, you add 1 to the tally. Then you can group by the resultdesc field to make sure the total for each fruit is displayed.

I will mark this as a solution, but if you are still having issues or have a follow-up question please let me know!