Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
heena_shaikh
Contributor II
Contributor II

Removed

 
1 Solution

Accepted Solutions
swuehl
MVP
MVP

You could create a mapping table with all values by adding a order information part delimited by a arbitrary delimiter not part of your key values ('|' in my sample). Then you can address first, second, etc mapping value per key:

MAP:

MAPPING

LOAD A&'|'&AutoNumber(Recno(),A) as A, B

INLINE

[

A B

1 A

1 B

2 C

3 D

3 E

4 F

] (delimiter is '\t');

LOAD A,

  Applymap('MAP', A&'|2', ApplyMap('MAP',A&'|1')) as Test

  INLINE

  [

  A

  1

  2

  3

  4

  ];

View solution in original post

8 Replies
ali_hijazi
Partner - Master II
Partner - Master II

suppose your original table is called T

then do the following:

T2:

mapping

load Column1, FirstSortedValue(Column2,-Column2)

resident T

group by Column1;

drop table T;

hope this helps

I can walk on water when it freezes
heena_shaikh
Contributor II
Contributor II
Author

 
swuehl
MVP
MVP

You could create a mapping table with all values by adding a order information part delimited by a arbitrary delimiter not part of your key values ('|' in my sample). Then you can address first, second, etc mapping value per key:

MAP:

MAPPING

LOAD A&'|'&AutoNumber(Recno(),A) as A, B

INLINE

[

A B

1 A

1 B

2 C

3 D

3 E

4 F

] (delimiter is '\t');

LOAD A,

  Applymap('MAP', A&'|2', ApplyMap('MAP',A&'|1')) as Test

  INLINE

  [

  A

  1

  2

  3

  4

  ];

heena_shaikh
Contributor II
Contributor II
Author

 
tresesco
MVP
MVP

It's because you are coy-pasting it and '\t' is not working properly in that case. Try using different (comma) separator like:

MAP:

MAPPING

LOAD A&'|'&AutoNumber(Recno(),A) as A, B

INLINE

[

A, B

1, A

1, B

2, C

3, D

3, E

4, F

];

LOAD A,

  Applymap('MAP', A&'|2', ApplyMap('MAP',A&'|1')) as Test

  INLINE

  [

  A

  1

  2

  3

  4

  ];

Peter_Cammaert
Partner - Champion III
Partner - Champion III

There are no tab characters between column headers and field values. Either replace the spaces with a tab character, or change this

(delimiter is '\t');


to this


(delimiter is ' ');

ali_hijazi
Partner - Master II
Partner - Master II

from the sample data you supplied you can take the max group by first column and do the mapping table

I can walk on water when it freezes
antoniotiman
Master III
Master III

Hi,

maybe this

MapTable:
Mapping
LOAD A,LastValue(B) as B Inline [
A, B
1, A
1, B
2, C
3, D
3, E
4, F]

Group By A;

LOAD DISTINCT A,ApplyMap('MapTable',A) as B Inline [
A, C
1, 12
1, 23
2, 34
3, 45
3, 56
4, 67]
;

Regards,

Antonio