Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
Hi,
is there a way to create a stablel random list bwtween, two numbers; so a staable list 1 to 10 could be
= List.Transform(
List.Random( 20,1), (x)=>
Number.IntegerDivide( ( x * 10 ) ,1 )
) the problem is this method always starts at 1 and i would like to cntrol the min and max vaulues,
what i woud like is stable version of
List.Transform( {1..100},(x)=>
let n =
Number.IntegerDivide( Number.RandomBetween( 97, 122),1)
in
Character.FromNumber(n) ) any suggestions,
Richard.
Solved! Go to Solution.
You are missing the +min at the end to make it start from 97. If you run yours, the numbers won't start from min. Check the one I have shared for ten values (Count):
If this is not what you are looking for, please describe the ouput you are imaging for the function.
Regards
Happy to help!
Hello @Dicken ,
Can you try List.Random function?
You can check this.
If this solved your issue, please mark it as the accepted solution. ✅
Hi. Do you mean a list of random that even after a refresh will keep same values?
You could build it like the following code, specifying a seed to make it deterministic. Add a New blank query and create the function, you can call it getRandom:
(min as number, max as number, count as number, seed as number) =>
let
range = max - min + 1,
rnd =
List.Transform(
List.Random(count, seed),
each Number.IntegerDivide(_ * range, 1) + min
)
in
rnd
Then you can call it any where, for example using your nros as example:
getRandom(97,122,100,1)
That would generate 100 estable numbers between 97 and 122.
I hope that helps,
Happy to help!
Not sure i get this ;
let
range = max - min + 1,
rnd =
List.Transform(
List.Random(count, seed),
each Number.IntegerDivide(_ * range, 1) + min
)
in
rndit does not seem very different to what I posted, and haveing tried, i still have a range starting at 0 ,
can you show an actual example, where a random list stable List is produced between a min andn max valess say 10 an 20 ? I have tried the abvoe
let
range = (122 - 97)+1
in
List.Transform(
List.Random( 20, 1) , (x)=> Number.IntegerDivide( x * range , 1)
)and it just takes gvies range of 1 - 26 ?
Richard.
You are missing the +min at the end to make it start from 97. If you run yours, the numbers won't start from min. Check the one I have shared for ten values (Count):
If this is not what you are looking for, please describe the ouput you are imaging for the function.
Regards
Happy to help!
Thanks, think i've got it;
let
acount = 20,
max = 20 ,
min = 10 ,
range = (max - min) +1 ,
rnd =
List.Transform(
List.Random( acount , 1 ),
each Number.IntegerDivide(_ * range, 1) + min
)
in
rnd
Just trying to get the logic, i see it and then it slips away 😊
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |