I need to click this button to change a value of 5 randomly selected rows. The formula in the screenshot can be entered without error, but when I click the button, either nothing happens or I get a “reading” error message. What am I doing wrong?
Hi @Ross_Chehayeb1 
 !
I think there’s just a condition missing in the Custom Filter of your button ![]()
(As in the Custom Filter you used Table.RandomSample(5) which is then compared to nothing)
The Custom Filter could be something like (See button “Random 1” in the sample below) :
CurrentValue.Contains(Table.RandomSample(5))
 
CurrentValue represents here each row from your table which will then be compared to whatever rows RandomSample() is currently returning …
In other words, this will tell to the Custom Filter to keep only the rows containing the 5 random rows RandomSample() is returning and then modify the checkbox for those rows ![]()
You could have also used a complete Action Formula instead 
 such as this one :
(See button “Random 2”)
Table.RandomSample(5).ModifyRows(
  Table.[Column 2],True()
)
… Which I just find easier as there’s no need for the filter ![]()
(Table.RandomSample(5) already returns a list of 5 rows which ModifyRows() can use and do what it needs to do 
 )
Hope this helps 
 !
The second option worked! Thank you so much.
No problem @Ross_Chehayeb1 
 !
Glad to know it helped 
 !
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.


