Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
jaryszek
Super User
Super User

Generate random list without duplicates

hi Guys,

 

I want it generate list from 1 to 13 and after that shuffle this list to get not sorted numbers. How can I do this ?

Iist.number and number.roundbetween are generating duplicates...

 

Best 

Jacek


Best Wishes,
Luke Jarych

From data chaos to business clarity — let’s connect and solve data challenges together.
LinkedIn Connect with me on LinkedIn
1 ACCEPTED SOLUTION
dufoq3
Community Champion
Community Champion

I simply don't understand why - bacause you can just delete Random column after sorting... But if you don't want see that step as separate column - you can merge that steps into 1 for example: 

 

 

let
    Source = Table.FromList({1..13}, Splitter.SplitByNothing(), type table[Numbers = Int64.Type]),
    Randomized = Table.RemoveColumns(Table.Sort(Table.AddColumn(Source, "Random", each Number.Round(Number.RandomBetween(1, 100), 0), Int64.Type),{{"Random", Order.Ascending}}),{"Random"})
in
    Randomized

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

4 REPLIES 4
jaryszek
Super User
Super User

Thank you very much! 

Can I do this only with a list without adding new column ?


Best Wishes,
Luke Jarych

From data chaos to business clarity — let’s connect and solve data challenges together.
LinkedIn Connect with me on LinkedIn
dufoq3
Community Champion
Community Champion

Hi @jaryszek,

 

Create custom column with numbers i.e. 1-100 and sort by this random column. After sort you can delete Random column.

dufoq3_0-1706950707038.png

let
    Source = Table.FromList({1..13}, Splitter.SplitByNothing(), type table[Numbers = Int64.Type]),
    Ad_Random = Table.AddColumn(Source, "Random", each Number.Round(Number.RandomBetween(1, 100), 0), Int64.Type),
    #"Sorted Rows" = Table.Sort(Ad_Random,{{"Random", Order.Ascending}})
in
    #"Sorted Rows"

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Thank you very much @dufoq3  

Can I do this only with a list without adding new column ?


Best Wishes,
Luke Jarych

From data chaos to business clarity — let’s connect and solve data challenges together.
LinkedIn Connect with me on LinkedIn
dufoq3
Community Champion
Community Champion

I simply don't understand why - bacause you can just delete Random column after sorting... But if you don't want see that step as separate column - you can merge that steps into 1 for example: 

 

 

let
    Source = Table.FromList({1..13}, Splitter.SplitByNothing(), type table[Numbers = Int64.Type]),
    Randomized = Table.RemoveColumns(Table.Sort(Table.AddColumn(Source, "Random", each Number.Round(Number.RandomBetween(1, 100), 0), Int64.Type),{{"Random", Order.Ascending}}),{"Random"})
in
    Randomized

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors