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: 
Anonymous
Not applicable

transforming a field in a load script (not via front end)

How can I change the Place field to be for each Name - the current Place minus the minimum number of the place for this Name +1?

02-05-2018 14-41-37.png

LOAD * INLINE [

    Place, Name, Score

    5, a, 5

    1, b, 6

    10, c, 7

    6, a, 8

    2, b, 9

    20, c, 10

    8, a, 11

];

1 Solution

Accepted Solutions
sunny_talwar

Try this

Table:

LOAD *,

AutoNumber(Place, Name) as Key;

LOAD * INLINE [

    Place, Name, Score

    5, a, 5

    1, b, 6

    10, c, 7

    6, a, 8

    2, b, 9

    20, c, 10

    8, a, 11

];


Left Join (Table)

LOAD Name,

Place as New_Place

Resident Table

Where Key = 1;


FinalTable:

LOAD Place - New_Place + 1 as Place,

Name,

Score

Resident Table;


DROP Table Table;

View solution in original post

2 Replies
sunny_talwar

Try this

Table:

LOAD *,

AutoNumber(Place, Name) as Key;

LOAD * INLINE [

    Place, Name, Score

    5, a, 5

    1, b, 6

    10, c, 7

    6, a, 8

    2, b, 9

    20, c, 10

    8, a, 11

];


Left Join (Table)

LOAD Name,

Place as New_Place

Resident Table

Where Key = 1;


FinalTable:

LOAD Place - New_Place + 1 as Place,

Name,

Score

Resident Table;


DROP Table Table;

Anonymous
Not applicable
Author

very impressive, thanks