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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

Rename duplicated Values

Dear all,

 i have a table like this:

Name
Mark
Julia
Mike
John
John
John

 

i want to rename all duplicated in order to have only distinct values to obtain

Name
Mark
Julia
Mike
John
John 2
John 3

 

How to do this?

thanks

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Try like:

Load *,
                Name& If(AutoNumber(RowNo(),Name)>1,AutoNumber(RowNo(), Name)) as NewName

Inline [
Name
Mark
Julia
Mike
John
John
John]

View solution in original post

3 Replies
Taoufiq_Zarra
MVP
MVP

Hi @micheledenardi 

One solution:

Data:

LOAD * INLINE [
    Name
    Mark
    Julia
    Mike
    John
    John
    John
];

Tmp:
noconcatenate

load *,if(rowno()=1,1,if(peek(Name)=Name,peek(n)+1,1)) as n resident Data order by Name;

drop table Data;


Final:
noconcatenate

load if(n=1,Name,Name&n) as Name resident Tmp;

drop table Tmp;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
tresB
Champion III
Champion III

Try like:

Load *,
                Name& If(AutoNumber(RowNo(),Name)>1,AutoNumber(RowNo(), Name)) as NewName

Inline [
Name
Mark
Julia
Mike
John
John
John]

AbhijitBansode
Specialist
Specialist

Why can'y you append rowNo() with Name column:

 

Name&' '&RowNo() as distinctName