Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Set variables in script to highest and 2:nd higest most frequent value


This is my first post in this forum, and I need help..

I'm stuck on how to best do this. Or actually, how to do it all..  I'm not sure how to start. I have a date that is set every 2-3 months or so for a couple of thousands product numbers.. It's the same date for all product numbers. Between  this interval of 2-3 months, a couple of product numbers can have new dates assigned do them. So an example for the year 2012 could be.

Date                   Count

2012-01-15          2500

2012-02-10          12

2012-03-15          2600

2012-03-16          2

2012-05-15          2550

2012-06-01          4

2012-07-15          2700

2012-10-10          2600

2012-11-10          1

2012-12-20          2400

I want to set two variables to always have the maxdate and the second maxdate, only reflecting the dates that have a count of >100. At the same time I want he product numbers with dates <100 to be included in previous date with a count of >100.

So if the current date is 2012-06-20 I want

maxdate1 = '2012-05-15' and

maxdate2 = '2012-03-15'

The date 2012-03-16  should be grouped with 2012-03-15  and 2012-06-01  with 2012-05-15.

I think it should be done in the script.

Best Regards


Tags (3)