Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
andrefpc
Partner - Creator II
Partner - Creator II

Stock Quantity for each year

Hi everyone!

I'm facing i problem in my qlikview app.

I created a field that, for each month, stores the quantity in stock for each product, based on another field that stores the variation.

What I want to do know is to create a table showing only the last value (december) for each year, but seems that QV always makes the sum of every month.

Thanks in advance.

1 Solution

Accepted Solutions
Not applicable

Also one more thing to notice about Firstsortedvalue is that it should return only one unique value. For example if Dec of 2012 has two quantities like 20 and 30 it will be null. In that case you can create a flag in the backend and use Set analysis in sum.

Please check out the attached doc.

View solution in original post

11 Replies
Not applicable

Hi Andre,

You can use Firstsortedvalue(). It is a very powerful function and it might solve your problem.

If you still have issues please attach your sample doc.

Thanks

AJ

andrefpc
Partner - Creator II
Partner - Creator II
Author

Thanks for your reply Ajay. I already tried that function.

Basically want I want to accomplish in the table is, p.e. for 2012, show only the stock quantity for december, which the correct valu, not the sum of every month.

Not applicable

Would it be possible to attache a sample qvw with some dummy data just to get an idea of all the fields in the table.

andrefpc
Partner - Creator II
Partner - Creator II
Author

Here it is...QV is calculating the sum for all months but I only want for the max of the month, for each year.

Not applicable

Done.

Not applicable

Also one more thing to notice about Firstsortedvalue is that it should return only one unique value. For example if Dec of 2012 has two quantities like 20 and 30 it will be null. In that case you can create a flag in the backend and use Set analysis in sum.

Please check out the attached doc.

andrefpc
Partner - Creator II
Partner - Creator II
Author

I'm very thankful for your help AJ, I had already tried that, works the way I want in the dummy data but its not working corretly in my real project, I'm afraid I can't recriate all the variables, it's quite a big app.

Thanks anyway.

andrefpc
Partner - Creator II
Partner - Creator II
Author

With some tweeks the flag seems to work fine...but there's a problem, which is the current year, the table should display the quantity for january but january is not the max month for 2014, am I missing something?

Not applicable

Can you rephrase that.

It should display quantity for Jan of 2014 as thats the max month. Once we get into Feb then it will ignore Jan and show for Feb.

So the way it works is if a Year has data for months 1,2,3,4,5,6,7,8 then the max month would be 8 (August) and it will show quantity for August. It would change dynamically based on the max month for each year. It wouldn't always be dec.