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
Antmkjr
Post Patron
Post Patron

Random Number

How can I use RANBETWEEN formula, but make it more stable, as everytime i open the report , it varies too much.

 

Eg: I am using RANDBETWEEN(90,210) but the variation should be minimum each time i open the report/refresh.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Antmkjr 

 

Thank you very much dharmendars007 for your prompt reply.

 

The generation of random numbers focuses on randomness, so you want the RANDBETWEEN function to be more stable, which may defeat the meaning of randomness.

 

However, you might consider pre-generating a table of random numbers and using it in your report so that the random numbers are within the range of the pre-generated table on every refresh. For example:

 

"RandomNumbers"

 

vnuocmsft_0-1727145175069.png

 

Create a measure.

 

RandomNumber = 
VAR Index = RANDBETWEEN(1, COUNTROWS('RandomNumbers'))
RETURN
CALCULATE(
    FIRSTNONBLANK('RandomNumbers'[RandomValue], 1),
    FILTER('RandomNumbers', 'RandomNumbers'[Index] = Index)
)

 

Here is the result.

 

vnuocmsft_1-1727145234199.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Antmkjr 

 

Thank you very much dharmendars007 for your prompt reply.

 

The generation of random numbers focuses on randomness, so you want the RANDBETWEEN function to be more stable, which may defeat the meaning of randomness.

 

However, you might consider pre-generating a table of random numbers and using it in your report so that the random numbers are within the range of the pre-generated table on every refresh. For example:

 

"RandomNumbers"

 

vnuocmsft_0-1727145175069.png

 

Create a measure.

 

RandomNumber = 
VAR Index = RANDBETWEEN(1, COUNTROWS('RandomNumbers'))
RETURN
CALCULATE(
    FIRSTNONBLANK('RandomNumbers'[RandomValue], 1),
    FILTER('RandomNumbers', 'RandomNumbers'[Index] = Index)
)

 

Here is the result.

 

vnuocmsft_1-1727145234199.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

dharmendars007
Super User
Super User

Hello @Antmkjr , 

 

When you say resut should be minimum can you be more specific like coould you share a example like expected result..This will help us to check further.

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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