Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

nevilledhamsiri
Valued Contributor

Customer sorting

Hi members,

I need the branches to be sorted as like below.

1 RA

2 EH

3 K7

4 K9

5 EM

6 AS

7 TA

8 MY

I need this to be done in the form of an expression but not in the front end.

Thanks

Neville

 

2 Solutions

Accepted Solutions
JGMDataAnalysis
Contributor II

Re: Customer sorting

SortingMap:
MAPPING LOAD *
INLINE [
txt, num
RA, 1
EH, 2
K7, 3
K9, 4
EM, 5
AS, 6
TA, 7
MY, 8
];

NOCONCATENATE
LOAD
BRANCH,
PREMIUM,
Dual(BRANCH, ApplyMap('SortingMap', BRANCH, 100000)) AS BranchTemp
FROM [D:\CUSTOMER SORTING.xlsx] (ooxml, embedded labels, table is Sheet1);

DROP FIELD BRANCH; RENAME FIELD BranchTemp TO BRANCH;

View solution in original post

JGMDataAnalysis
Contributor II

Re: Customer sorting

You just have to add the BRANCH field as a dimension in a chart and make sure it is numerically ordered.

clipboard_image_34.png

View solution in original post

5 Replies
Highlighted

Re: Customer sorting

As an expression, but not on front end? what do you mean? Not sure I completely understand

nevilledhamsiri
Valued Contributor

Re: Customer sorting

Yes,

It likes, I need this to be achieved not in the script level. May be as a calculated dimension etc

 

JGMDataAnalysis
Contributor II

Re: Customer sorting

SortingMap:
MAPPING LOAD *
INLINE [
txt, num
RA, 1
EH, 2
K7, 3
K9, 4
EM, 5
AS, 6
TA, 7
MY, 8
];

NOCONCATENATE
LOAD
BRANCH,
PREMIUM,
Dual(BRANCH, ApplyMap('SortingMap', BRANCH, 100000)) AS BranchTemp
FROM [D:\CUSTOMER SORTING.xlsx] (ooxml, embedded labels, table is Sheet1);

DROP FIELD BRANCH; RENAME FIELD BranchTemp TO BRANCH;

View solution in original post

nevilledhamsiri
Valued Contributor

Re: Customer sorting

Thanks JGMD

This is fine. If this is to be achieved in front end,how it will b done?

Thanks

Neville

JGMDataAnalysis
Contributor II

Re: Customer sorting

You just have to add the BRANCH field as a dimension in a chart and make sure it is numerically ordered.

clipboard_image_34.png

View solution in original post