Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

5 Replies
balabhaskarqlik

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

tresesco
MVP
MVP

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