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: 
Not applicable

Group by function

Hi All,

I have an issue,

   

PROC_IDPERIL_CDTRTY_SHRT_TXTNAMEYEARLOSSEVNT_IDREC
1872EQCNTYAAA1291011111000
1872EQCNTYAAA127002222000
1872EQNPAAA227803333000
1872EQNPAAA228904441500
1872EQMMAAA37887555600
1872EQCNTYAAA467676660
1872EQCNTYAAA46767777

0

from this table i need MAX(REC) by PERIL_CD,TRTY_SHRT_TXT and YEAR.

following is expected output.

 

PROC_IDPERIL_CDTRTY_SHRT_TXTNAMEYEARLOSSEVNT_IDREC
1872EQCNTYAAA127002222000
1872EQNPAAA227803333000
1872EQMMAAA37887555600
1872EQCNTYAAA467677770

when rec is same consider any one of the record.

2 Replies
sunny_talwar

May be try this:

Table:

LOAD PROC_ID,

    PERIL_CD,

    TRTY_SHRT_TXT,

    NAME,

    YEAR,

    LOSS,

    EVNT_ID,

    REC,

    REC * 1000000 + EVNT_ID as NewColumn

FROM

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

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

Right Join (Table)

LOAD PROC_ID,

  PERIL_CD,

    TRTY_SHRT_TXT,

    YEAR,

    Max(NewColumn) as NewColumn

Resident Table

Group By PROC_ID, PERIL_CD, TRTY_SHRT_TXT, YEAR;

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Try this:

Data:

LOAD PERIL_CD,

  TRTY_SHRT_TXT,

     YEAR, 

     max(REC) as REC

FROM

(ooxml, embedded labels, table is Sheet1)

Group by PERIL_CD, TRTY_SHRT_TXT, YEAR;

Left join (Data)

LOAD PROC_ID,

     PERIL_CD,

     TRTY_SHRT_TXT,

     NAME,

     YEAR,

     LOSS,

     EVNT_ID,

  REC

FROM

(ooxml, embedded labels, table is Sheet1);

The outcome:

Screenshot_2.png

Just one issue appears. How did you come up with the logic for year 4?