Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
qlikviewforum
Contributor II

How to pick only these QVD's from the list of QVD's?

Hi,

I have list of following  QVD's, where I need to fetch first 2 QVD's for the Max(Month/Year) and for rest of the Month/Year I need to fetch only the first QVD. QVD's which need to be picked is highlighted in RED.

Any thoughts on this please!

S2.JPG

Thanks,

qvforum

Tags (2)
1 Solution

Accepted Solutions
fosuzuki
Valued Contributor II

Re: How to pick only these QVD's from the list of QVD's?

Check the sample qvw.

Hope this helps you

Fernando

7 Replies
fosuzuki
Valued Contributor II

Re: How to pick only these QVD's from the list of QVD's?

Check the sample qvw.

Hope this helps you

Fernando

qlikviewforum
Contributor II

Re: How to pick only these QVD's from the list of QVD's?

Hi Fernando

Thank you so much for your help. It works perfectly!

Now I am trying to do something like below:

Let vPeriod = 3; //Based on this value I want to put a flag as PICK for latest 3 months and rest of month as drop as drop

Data:

LOAD QVD,

     date(date#(SubField(QVD,'.', 2), 'YYYY_MM_DD')) AS Date,

     date(monthstart(date#(SubField(QVD,'.', 2), 'YYYY_MM_DD'))) AS MonthYear

FROM

C:\Users\fernando.suzuki\Downloads\Data.xls

(biff, embedded labels, table is [Sheet1$]);

Left Join

LOAD date(max(MonthYear)) AS MaxMonthYear

Resident Data;

Left Join

LOAD QVD,

     MonthYear,

     if(Peek('MonthYear') <> MonthYear, PICK, if(MaxMonthYear = MonthYear and Peek('MonthYear', -2) <> MonthYear, PICK, DROP)) AS Flag

// I want the above condition to be applied only for the latest 3 Months(Value based on vPeriod).(i,e) QVDNAME_2012_11_28 to QVDNAME_2012_09_05.

So that means I want to put a Flag as PICK or DROP using above condition only for latest 3 months. Flag for rest of the records will be DROP.

(i,e) QVDNAME_2012_08_29 to QVDNAME_2012_08_13.

Resident Data

Order By Date DESC;

Result should be exactly like below:

qv.jpg

Thanks,

qvforum

Re: How to pick only these QVD's from the list of QVD's?

HI

PFA

qlikviewforum
Contributor II

Re: How to pick only these QVD's from the list of QVD's?

Thanks! It works fine. My requirement got changed something above. It would be great if you can help me out on that.

Re: How to pick only these QVD's from the list of QVD's?

HI

Can you mention the requirement, qlikview helpers definitely helps you.

qlikviewforum
Contributor II

Re: How to pick only these QVD's from the list of QVD's?

Hi Ramasamy

May I know what exactly you mean by "qlikview helpers definitely helps you."

By the way I have edited my needs in the above post. You can have a loot at it! By the way you can delete your post as it is not the one which I am looking for now.

Regards,

qvforum

Re: How to pick only these QVD's from the list of QVD's?

Hi

Please find attached file.

qlikview helpers means -> qlikview community members.

I didn't delete any post and even modify it. Can't get you

"! By the way you can delete your post as it is not the one which I am looking for now."

Community Browser