Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

populate data

Hi

I have following data in my QV document

     

POLICY_NOYEARPERIOD_FROMPERIOD_TONEW_RENLAST_REN_YEAR
7M00111C0000087201221-Oct-201220-Oct-2013REN-
7M00111C0000087201321-Oct-201320-Oct-2014REN2013
7M00141A0000245201404-Nov-201403-Nov-2015NEW-
7M00141A0000245201504-Nov-201503-Nov-2016REN2015
7M00141W0000022201406-Mar-201405-Mar-2015NEW-
7M00141W0000022201506-Mar-201505-Mar-2016REN2015
7M00131D0000089201310-Jun-201309-Jun-2014NEW-
7M00131D0000089201410-Jun-201409-Jun-2015REN-
7M00131D0000089201510-Jun-201509-Jun-2016REN2015
7M00141A0000253201431-Dec-201430-Dec-2015NEW-
7M00141A0000253201531-Dec-201530-Dec-2016REN2015
7M00151D0000140201508-Jan-201507-Jan-2016NEW-
7M00151D0000140201608-Jan-201607-Jan-2017REN2016
7M00144F0000002201429-Nov-201428-Nov-2015NEW-
7M00144F0000002201529-Nov-201528-Nov-2016REN2015
7M00141C0000155201428-Aug-201427-Aug-2015NEW-
7M00141C0000155201528-Aug-201527-Aug-2016REN2015

LAST_REN_YEAR IS MISSING IN SOME RECORDS I WANT TO POPULATE THE MISSING LAST_REN_YEAR WITH LAST_REN_YEAR OF THE CORRESPONDING POLIICY_NO

EG:

POLICY_NOYEARPERIOD_FROMPERIOD_TONEW_RENLAST_REN_YEAR
7M00111C0000087201221-Oct-201220-Oct-2013REN                     2013
7M00111C0000087201321-Oct-201320-Oct-2014REN2013

PLS HELP

1 Solution

Accepted Solutions
sunny_talwar

Looking to get this:

Capture.PNG

Script:

Table:

LOAD POLICY_NO,

    YEAR,

    PERIOD_FROM,

    PERIOD_TO,

    NEW_REN,

    LAST_REN_YEAR

FROM

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

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

FinalTable:

NoConcatenate

LOAD POLICY_NO,

    YEAR,

    PERIOD_FROM,

    PERIOD_TO,

    NEW_REN,

    If(POLICY_NO = Peek('POLICY_NO'), Peek('LAST_REN_YEAR'), LAST_REN_YEAR) as LAST_REN_YEAR

Resident Table

Order By POLICY_NO, YEAR desc;

DROP Table Table;

View solution in original post

4 Replies
sunny_talwar

Looking to get this:

Capture.PNG

Script:

Table:

LOAD POLICY_NO,

    YEAR,

    PERIOD_FROM,

    PERIOD_TO,

    NEW_REN,

    LAST_REN_YEAR

FROM

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

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

FinalTable:

NoConcatenate

LOAD POLICY_NO,

    YEAR,

    PERIOD_FROM,

    PERIOD_TO,

    NEW_REN,

    If(POLICY_NO = Peek('POLICY_NO'), Peek('LAST_REN_YEAR'), LAST_REN_YEAR) as LAST_REN_YEAR

Resident Table

Order By POLICY_NO, YEAR desc;

DROP Table Table;

maxgro
MVP
MVP

another one


Table:

LOAD POLICY_NO,

    YEAR,

    PERIOD_FROM,

    PERIOD_TO,

    NEW_REN,

    LAST_REN_YEAR

FROM

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

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

Left Join (Table)

load POLICY_NO, max(YEAR) as NEWYEAR Resident Table Group by POLICY_NO;

DROP Field LAST_REN_YEAR;

RENAME Field NEWYEAR to LAST_REN_YEAR;

upaliwije
Creator II
Creator II
Author

Thanks Sir,

Always helpful

Looking forward to more help from a expert like you

panosalexand
Creator
Creator

Hello all,

I have a similar issue and I can't find any solution yet. Let me narrate my story.

I have the following table

Data_temp:

Load
Center, GJAHR(is year), PERIO(is months in 001,002,003 format), Sales

From table1.qvd;

The problem is that Center has records lets say only for the Month 002 for 2024. How to enforce to display 0 Sales for the Center for the rest PERIOD?

How is now 

Center 002
900001 1000,34

 

vs how I'd like to be

Center 001 002 003 004 005
900001 0 1000,34 0 0 0

 

Any idea?

P.S: I tried to join a dummy table with 0 as sales but I didn't get the desired results.

Thanks,
Panos