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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
arethaking
Creator II
Creator II

Cummulative Sales

Hi Guys,

I have the data as shown below:

load * inline [

Date,Sales

01/01/2015,10

01/02/2015,20

01/03/2015,30

01/04/2015,40

01/05/2015,50

01/06/2015,15

01/07/2015,25

01/08/2015,35

01/09/2015,45

01/10/2015,55

01/11/2015,65

01/12/2015,10

01/01/2016,20

01/02/2016,30

01/03/2016,40

01/04/2016,50

01/05/2016,15

01/06/2016,25

01/07/2016,35

01/08/2016,45

01/09/2016,55

];

I want to show cummulative sum of sales.

For example If Month, SEP selected, I want to show the sum of values of sales from JAN to SEP in a Line chart.

How to achieve this?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Like the attached?

Capture.PNG

Expression:

Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date)), 'DD/MM/YYYY') & '<=' & Date(Max(Date), 'DD/MM/YYYY'))"}, Month, Year>}Sales)

View solution in original post

3 Replies
tresB
Champion III
Champion III

PFA for front-end solution.

sunny_talwar
MVP
MVP

Like the attached?

Capture.PNG

Expression:

Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date)), 'DD/MM/YYYY') & '<=' & Date(Max(Date), 'DD/MM/YYYY'))"}, Month, Year>}Sales)

sunny_talwar
MVP
MVP

Or if you want to get both the year's data in a single line, then may be this

Cummu_Sales:

load *, Month(Date) as Month,Year(Date) as Year, Num(Month(Date)) as MonthNum;

load date#(Date,'DD/MM/YYYY') as Date,Sales inline [

Date,Sales

01/01/2015,10

01/02/2015,20

01/03/2015,30

01/04/2015,40

01/05/2015,50

01/06/2015,15

01/07/2015,25

01/08/2015,35

01/09/2015,45

01/10/2015,55

01/11/2015,65

01/12/2015,10

01/01/2016,20

01/02/2016,30

01/03/2016,40

01/04/2016,50

01/05/2016,15

01/06/2016,25

01/07/2016,35

01/08/2016,45

01/09/2016,55

];

Expression:

Sum({<MonthNum = {"$(='>=1<=' & Max(MonthNum))"}, Month>}Sales)

Capture.PNG