Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

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.

shaunsomai
New Contributor

Creating a Range for a Defined list of values

Hi

I have this  set of data

  

Account Group1ACCTSEGVAL
Billings - Fees1100
Billings - Fees1101
Billings - Fees1102
Billings - Fees1200
Billings - Fees1210
Billings - Fees1220
Billings - Fees1300
Billings - Fees1301
Billings - Fees1302
Billings - Fees1303
Billings - Fees1304
Billings - Fees1305
Billings - Fees1306
Billings - Fees1307
Billings - Fees1308
Billings - Fees1309
Billings - Fees1310

Need to get it like this

   

Account Group1StartEnd
Billings - Fees11001102
Billings - Fees1200
Billings - Fees1210
Billings - Fees1220
Billings - Fees13001310

To be done in the script

Any Help Apprreciated

1 Reply
MVP
MVP

Re: Creating a Range for a Defined list of values

SCRIPT

a:

LOAD

  rowno() as id,

  [Account Group1],

    ACCTSEGVAL

FROM

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

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

b:

load

  *,

  if(ACCTSEGVAL=Peek(ACCTSEGVAL)+1, peek(Group), alt(Peek(Group),0)+1) as Group

Resident a

order by id;

final:

load

  [Account Group1],

  Start,

  if(End=Start, null(), End) as End;

load

  Group,

  [Account Group1],

  min(ACCTSEGVAL) as Start,

  max(ACCTSEGVAL) as End

Resident b

group by Group, [Account Group1];

DROP Table a, b;

 

RESULT

1.png