'How to compute YTD data on amazon-Quicksight?

Let's say that I have a dataset with a field Date and a field Sales and that each month, my sales are 5$. I would like to build the following table in quicksight :

Date      Sales
Jan 2021      5
Feb 2021     10
Mar 2021     15
...
Dec 2021     60
Jan 2022      5

Maybe the runningSum function could be the solution but I can't find the right way to reach the expected result. How please could I do ?



Solution 1:[1]

I finally figured out how to deal with the runningSum function.

First, create the computed field qs_year :

extract("YYYY",{Date})

Then, our target computed field is :

runningSum(sum({Sales}), [truncDate("MM",{Date}) ASC], [{qs_year}])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ewdlam