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.
swatitomar
New Contributor III

Add max of 1 field another another field

Hi Everyone.

I am Stuck at one point in Scripting..

Want to merge two field but issue is this max of one field on the basis of group with another field.

WHat I did:

In OLD QVD: I have group and old_grp and IN NEW QVD I have group and new_grp

I concatenate both the QVD but I didn't the Output as I want.

Example

OLD QVD

Groupold_grp
123201401
123201402
123201403
123201404
123201405
124201501
124201502
124

201503

NEW QVD

Groupold_grp
123201401
123201402
123201403
124201501
124

201502

OUTPUT as I want

Groupold_grp
123201401
123201402
123201403
123201404
123201405
123201406
123201407
123201408
124201501
124201502
124

201503

124201504
124201505

Please help me out..

Regards

Swati

4 Replies

Re: Add max of 1 field another another field

Like this?

Table:

LOAD Group,

    old_grp,

    'Old' as Flag

FROM

[https://community.qlik.com/thread/228151]

(html, codepage is 1252, embedded labels, table is @1);

Concatenate

LOAD Group,

    old_grp,

    'New' as Flag

FROM

[https://community.qlik.com/thread/228151]

(html, codepage is 1252, embedded labels, table is @2);

FinalTable:

NoConcatenate

LOAD Group,

  If(Group = Previous(Group) and Flag = 'New', RangeSum(Peek('old_grp'), 1), old_grp) as old_grp,

  Flag

Resident Table

Order By Group, Flag desc, old_grp;

DROP Table Table;


Capture.PNG

MVP
MVP

Re: Add max of 1 field another another field

a small change

FinalTable:

NoConcatenate

LOAD Group,

  If(Group = Previous(Group) and Flag = 'New',

  //RangeSum(Peek('old_grp'), 1), old_grp) as old_grp,

  Date(AddMonths(Date#(Peek('old_grp') & '01', 'YYYYMMDD'), 1), 'YYYYMM'),

  old_grp) as old_grp,

  Flag

Resident Table

Order By Group, Flag desc, old_grp;

swatitomar
New Contributor III

Re: Add max of 1 field another another field

Capture.PNG

here in the image you can see its showing the same as earlier ..that script doesn't work correctly..

Showing 2016-5 flag1-> new output_grp ->12301 ..instead of 12314

Re: Add max of 1 field another another field

Would you be able to share this application where you tried this out?

Community Browser