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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Not applicable

The best way to get random data from a table

I have a list with 532 rows. Those rows are splitted by months (like 200 rows as January, 200 rows as February and 132 rows as March).


What is the best way to add column with unique random number between 1 and 532?

I tried 


But it generates duplicates.


What I want to achieve is to be able to randomly select 50 rows from each month.

I thought to generate this unique random value and them apply some filters.


What do you think?



Resident Rockstar
Resident Rockstar

Hi ,

You may try to use the INDEX column to get unique numbers.


Below is something that I came across in a blog. You can try doing it this way to get unique Random values.


In DAX, you can use RAND() function  to generate random numbers. Similarly, to generate random numbers between two numbers, use  RANDBETWEEN().

In Power Query, List.Random() creates a list of random numbers, while Number.Random() creates a single random number. You can add an index column before using the Number.Random() to get different random numbers on each row. You can delete the index column after the Number.Random() step. There isn't a List.RandomBetween() but Number.RandomBetween() can be used along with index column to generate numbers between two specified values.




Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors