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

Random numbers without repeating

Hi, guys. I hope you can help me

I need exactly to assign a number to the value of the field Team Name between 1 and 8, but not repeat a already number assigned

Teams:

LOAD * INLINE [

TeamName

Mexico

Brazil

Colombia

France

USA

Argentina

Peru

Spain];

Example Result:

example.PNG

Thank's

Labels (1)
5 Replies
BalaBhaskar_Qlik
Master
Master

May be:

In Expressions: Rank(Only(TeamName),7) - Label - Rank

In Script:

Teams:

LOAD * INLINE [

TeamName

Mexico

Brazil

Colombia

France

USA

Argentina

Peru

Spain];

FinalTable:

LOAD *,

  If(TeamName <> Previous('TeamName'), RangeSum(Peek('Rank'), 1), 1) as Rank

Resident Table

Order By TeamName desc;

DROP Table Teams;

ogautier62
Specialist II
Specialist II

Hi

take a look at function Autonumber() it's made for this :

Autonumber(TeamName)

regards

tresB
Champion III
Champion III

Only thing is, it would not be random, but sequential.

ogautier62
Specialist II
Specialist II

you are right,

so :

LOAD  *, rand() as rand FROM    'your table'

 

load *, autonumber(rand) as nb resident 'your table' order by rand;

 

that changes on each load

petter
Partner - Champion III
Partner - Champion III

This is a way to get a randomly picked list of teams:

2018-07-26 12_11_42-Microsoft Edge.png