Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jm364D
Partner - Contributor
Partner - Contributor

Cummulative sum

Good afternoon,

I have a doubt that doesn't seem to be complicated, but I can't solve it.

I need to perform a cumulative sum of one metric by date.

For the following data :

Product                Date                      Units                     Accumulated

1                             01/01/2020        2                             2

1                             03/01/2020        5                             7

1                             05/01/2020        3                             10

1                             06/01/2020        -4                           6

1                             07/01/2020        1                             7

I need a cumulative sum by date, but  if the user does not select the entire period, the value for the unselected dates must be accumulated on the first selected date.

For example, if the user selects from January 5 to January 7, the values needed to be displayed are:

Product                Date                      Units     Accumulated

1                             05/01/2020        3             10

1                             06/01/2020        -4            6

1                             07/01/2020        1             7

 

I've tried so much with SetAnalysis :

  • Sum( { < Fecha = {'=$(=Date(vFechaMax))'} > } [Unidades] )

as with RangeSum + Above:

  • RangeSum( Above( Sum( [Unidades] ), 0 ,RowNo() ) )

 but I can't get the app returning  the correct values.

I'm getting the following values (INCORRECT)

Product                Date                      Units     Accumulated

1                             05/01/2020        3             3

1                             06/01/2020        -4            -1

1                             07/01/2020        1             0

 

Any help would be appreciated,

 

Thanks,

 

Juan Manuel

0 Replies