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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jaryszek
Post Prodigy
Post Prodigy

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

1 ACCEPTED SOLUTION

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
Post Prodigy
Post Prodigy

Thank you very much! 

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

dufoq3
Super User
Super User

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 ?

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors
Top Kudoed Authors