
Contributor
2015-08-19
10:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Creating a Range for a Defined list of values
Hi
I have this set of data
Account Group1 | ACCTSEGVAL |
Billings - Fees | 1100 |
Billings - Fees | 1101 |
Billings - Fees | 1102 |
Billings - Fees | 1200 |
Billings - Fees | 1210 |
Billings - Fees | 1220 |
Billings - Fees | 1300 |
Billings - Fees | 1301 |
Billings - Fees | 1302 |
Billings - Fees | 1303 |
Billings - Fees | 1304 |
Billings - Fees | 1305 |
Billings - Fees | 1306 |
Billings - Fees | 1307 |
Billings - Fees | 1308 |
Billings - Fees | 1309 |
Billings - Fees | 1310 |
Need to get it like this
Account Group1 | Start | End |
Billings - Fees | 1100 | 1102 |
Billings - Fees | 1200 | |
Billings - Fees | 1210 | |
Billings - Fees | 1220 | |
Billings - Fees | 1300 | 1310 |
To be done in the script
Any Help Apprreciated
- Tags:
- qlikview_scripting
1,034 Views
1 Reply

MVP
2015-08-19
10:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
753 Views
