Get a random results from a filtered list in a formula

#1

You can get a random number between 0 and 1 using the formula Random() . If you add this into a table as a column formula and use Random(true) , the value will update each time the row is edited. Depending on your scenario you could use this the Nth() formula which returns the nth element in a list something of the form: List.Nth(Remainder(Random(true) * 1000, List.Count()).RoundDown() + 1)

Breaking this out:

  1. Random(true) * 1000 will generate a random decimal number in the range 0 -> 1000
  2. Remainder(Random(true) * 1000, List.Count()).RoundDown() will convert this to a number in the range 0 - N-1 where the list is of length N
  3. List.Nth(Remainder(Random(true) * 1000, List.Count()).RoundDown() + 1) will take that number returning the nth value in the list
1 Like