Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Line Chart, choose date, accumulative sum?

Hello gurus.

I'm quite new to QlikView, and have some trouble with creating a line chart with accumulative values.

I've searched around, but either I suck at searching, or the answers and solutions I've tried haven't worked.

I'm creating a report regarding warehouse stock over time.

I have a data file giving me different movement types on products, quantities in/out date-wise (if you're familiar with SAP, it's the MB51-report).

Now, I want to have a line-chart that will give me total value of the stock on a selected date, and total quantities.

As this is a "balance", I need to sum from day one up to the selected date.

In a straight table, this expression does the trick, at least showing me the stock on a particular date;

Sum({<Date={"<=$(=max(Date))"}>} [Quantity])

But my line chart (using month/year as dimension) seems to sum the quantity movements each month instead of giving me the total quantity (= stock quantity).

Would anyone be helpful on this problem?

Quantity line chart.png

The in-going balance at the start in November 2011 shows a quantity of 171.000, and December 2011 shows 37.000.

But the stock quantity in December should be 171.000+37.000 = 208.000.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Use something like below

RangeSum(Above(SUM({<Date = {"<=$(=Max(Date))"}>}Quantity),0,RowNo()))

View solution in original post

13 Replies
MK_QSL
MVP
MVP

Use something like below

RangeSum(Above(SUM({<Date = {"<=$(=Max(Date))"}>}Quantity),0,RowNo()))

nitin_01
Creator
Creator

Hi Vegard,

               You can use 'Accumulate' under Expression tab in the chart using graphically or you can use the set expression as said by @manish kachhia in above comment.

Regards,

Nitin

Anonymous
Not applicable
Author

That's brilliant, Manish - works like a charm!

Now, I know this wasn't part of my original question, but say I'm choosing a year, lets say 2015.

The chart now only shows the 12 months in that year which is what I want, but it then just sums whatever happened that year.

Would it be possible to, in the same chart, to choose a year, and get the same values as from your expression?

It would basically be just a "zoom" of this result:

Quantity line chart 2.png

Anonymous
Not applicable
Author

Ah, that was also helpful

Thanks, Nitin!

sunny_talwar

May be like this

RangeSum(Above(SUM({<Date = {"<=$(=Max(Date))"}, YearField>}Quantity), 0, RowNo())) * Avg({<Date = {"<=$(=Max(Date))"}>}1)

MK_QSL
MVP
MVP

stalwar1‌solution will work.. Just check and update here.

Anonymous
Not applicable
Author

Changed YearField to Year, but getting "No data to display".

RangeSum(Above(SUM({<Date = {"<=$(=Max(Date))"}, Year>}Quantity), 0, RowNo())) *

Avg({<Date = {"<=$(=Max(Date))"}>}1)

MK_QSL
MVP
MVP

It should work.. I just checked with dummy data and it's working...

sunny_talwar

Yup, I don't see a reason why it shouldn't work. Would you be able to share a sample where this isn't working for you?

Preparing examples for Upload - Reduction and Data Scrambling

Uploading a Sample